A little prototype I am making for my game, where the player's material should change when colliding with the white object. gameObject.GetComponent<Renderer>().material = newMaterial; This code is not working, I even tried to use this code at the start just to check if this works but doesn't. I have made sure to assign the…
Not sure if you still need help, but I suggest you set a breakpoint in that line and check if the GetComponent actually finds your Renderer Component. My first guess would be, that it cant find it. It would also be helpful to see a full example of your code, because the problem may lay somewhere else. You can also try to…