- Home /
Changing a material source
Hey everyone,
Anyone know how I can change this via script?
Thanks!
EDIT: I am only applying this script to Unity's standard shader.
Answer by JVene · Aug 22, 2018 at 04:22 AM
The details are beyond the scope of a post here, but Unity Docs on scripting access to material parameters gives you most of the details. Basically, these are not simply available as members of a class, as you're probably accustomed to, but are a keyed list of parameters. Read through, the access to Smoothness is there (look for the keyword '_METALLICGLOSSMAP' in the chart to get you started).
Take some caution here. Read through so you don't get bitten. If you adjust these only in code, you can create a situation where a material is created in code that Unity doesn't 'realize' is in your project, and might not get packaged in the build unless you read through how to arrange for that to work out correctly.
Check the related materials indicated to see what applies to your overall situation.
Thanks for the reply!
I am only using this script with Unity's standard shader, but doesn't "_$$anonymous$$ETALLICGLOSS$$anonymous$$AP" change the smoothness slider?