Shader property shared between materials

Node-based Shader Editor

Shader property shared between materials

Postby elettrozero » Sat Feb 03, 2018 6:00 pm

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?
elettrozero
 
Posts: 15
Joined: Fri Jan 26, 2018 10:43 pm

Re: Shader property shared between materials

Postby Ricardo Teixeira » Sat Feb 03, 2018 7:24 pm

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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests