i have several scenes with several objects that all have a script attached which changes the material of its object to one common material for highlighting.
how would i assign that material to the script programmatically? Currently i drag the script to the object and assign this material manually for each object, but there are hundreds more to come.
is there an equivalent for
Shader.Find("shader name")
that works with materials?
edit:
i now use one instance of a class MaterialStorage in each scene and get the material from there:
MaterialStorage storage = FindObjectOfType(typeof(MaterialStorage)) as MaterialStorage;
if(storage != null) this.highlightMaterial = storage.getHighlightMaterial();
↧