Changing Material not colour

As im using prototype material asset from asset store, i didnt want it to just be new colour so i done research and managed to make it change its own material
image

2 Likes

Hey there, I hope I can help. I’m fairly new to C# but I will try and give my 2 cents.

So I see that you serialized a field for newMaterial but you didn’t define what it is. So I think Unity just gives it a null reference. You need to declare what it is first in order for unity to understand. For example:

newMaterial = GetCompenent().color;

1 Like

Privacy & Terms