Below are some code wich instanciates a model. Now I want the models material name to be printed in the Debug.Log. Ive tried a bit with instance.GetComponent but cant get it to work. Anyone know the solution?
var instance : GameObject = Instantiate(Resources.Load(targetModel)) as GameObject;
Debug.Log(???);
One thing thou, Currently it prints out: “red (instance)” in the debug log. Is it possible to somehow only get the name: “red”. Or how do I remove “(instance)” from the string?
If coming off an object … it’s ESSENTIAL that you use “sharedMaterial” to get the name … otherwise you are making a new instance of the material!