Shader property shared between materials

Node-based Shader Editor
Post Reply
elettrozero
Posts: 15
Joined: Fri Jan 26, 2018 10:43 pm

Shader property shared between materials

Post by elettrozero »

Sorry I cannot find how to setup a property that, once changed on one material, every other material using that shader gets that property the same value.
----
Edit: I think that what I need is a Global property but, by setting the value using Unity Script like this:
materialInstance.SetVector("_PlayerPosition", _transform.position);
doesn't do anithing.
Can you help me?
User avatar
Ricardo Teixeira
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Shader property shared between materials

Post by Ricardo Teixeira »

elettrozero wrote:Sorry I cannot find how to setup a property that, once changed on one material, every other material using that shader gets that property the same value.
----
Edit: I think that what I need is a Global property but, by setting the value using Unity Script like this:
materialInstance.SetVector("_PlayerPosition", _transform.position);
doesn't do anithing.
Can you help me?

Hello,

Material properties are unique to each material, constants (default type) do apply to every material.

Be sure to check the Smear sample (AmplifyShaderEditor\Examples\Official\Smear), it does exactly what you are looking for; scripts included.

Be sure to let us know if you have any additional questions, we would be happy to help.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply