How to change a prefab's color before instantiating (with code)

I’ve googled and found a multitude of forums discussing this topic but nothing that satisfied what I need to do.


My situation: My game has a store where you can unlock aesthetic changes to the objects that are procedurally generated in the scene. These aesthetic changes are stored as materials. How can I use C# to change the non-instantiated prefab’s material?

I don’t think you are able to change or delete anything regarding a prefab in Unity, due to data loss, or it is highly recommended against. I might be wrong. However, you could try creating a copy of the prefab with a different color, and adding it to your prefabs folder. Try having a look at PrefabUtility. See Doc Here

@thelonelypanda