Answer the question
In order to leave comments, you need to log in
How to change the color of a prefab?
I do this, for example, the prebuff will consist of such components
Tree - an empty object, I also added MeshRenderer
---BaseTree - cube
---HeadTree - sphere,
then I want to change the color of the whole tree
Renderer MainRenderer;
void Start(){
MainRenderer = GetComponent<Renderer>();
}
public void SetTransparent(bool available){
if (available) MainRenderer.material.color = Color.green;
else MainRenderer.material.color = Color.red;
}
public Renderer MainRenderer;
// start убрать
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question