Quantcast
Channel: Latest Questions by jpenca
Viewing all articles
Browse latest Browse all 16

get material from the library at runtime

$
0
0
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();

Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>