- Home /
Why isn't object rendering the right material?
Hey guys! So I made this simple script which makes all "unclickable" object grey (it simply give them different material), but In the game it simply does not work.
This is my script:
public bool isClickable;
public Material unclickableMat;
void Start () {
if(Random.value > 0.5f){
isClickable = true;
}
else{
isClickable = false;
GetComponent<Renderer>().material = unclickableMat;
}
}
In editor it shows as it would change materials, but I don't think its working.
I know that I explain that pretty poorly, so here are screenshots, on with clickable object and other non-clickable.
Even though it shows the object as using your unclickable material, and even though that materials preview is grey, that unclickable grey material still seems to have a blue albedo. I suspect that the material preview may be busted, and that your "unclickable$$anonymous$$at" is actually blue.
Try changing the albedo of unclickable$$anonymous$$at to grey.
Answer by cstooch · Jun 26, 2017 at 05:22 AM
What's weird to me is that your preview pic (for lack of a better term) for your unclickable material shows grey, but the little color picker below it shows it that blue. What if you use the picker and set it to grey, then try again?
Your answer
Follow this Question
Related Questions
UniRPG Error cs0121. 0 Answers
RenderTexture.Create failed: format unsupported 0 Answers
How to pause countdown 0 Answers
PDF Reader for android 1 Answer
Camera.render weird issue? 0 Answers