- Home /
Change materials at runtime
Hello! Basically, i have many objects with material called #Base. At runtime, if i click on a button, is it possible to make it so the #Base material gets replaced by material called #Black or something? Keep in mind, each object has #Base, #DarkMetal,#Lights and other materials, but i only need to change #Base (Basically paintjob for a vehicle)
Answer by dan_wipf · Nov 07, 2018 at 05:38 PM
well you could make a list of materials, and when needed asign them to your remderer.
//for example
getcomponent<renderer>().material = mymaterials[yourvalue];
Your answer
Follow this Question
Related Questions
Replace texture without touching materials? 1 Answer
Multiple Materials on Multiple Objects -runtime- 1 Answer
Getting/setting texture offsets during raycast 2 Answers
What is a light weight option for changing the color of a LWRP material at runtime? 1 Answer
Grab Image/texture from MTL file and apply to a game object 1 Answer