How to get material name from instance

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(???);

I think materials inherent the name function.

Try

instance.material.name

guessing.

material.name.Replace(“(Instance)”,“”);

make sure “(Instance)” is typed correctly otherwise it will not replace it

Thanks!

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?