Ok , i was working in 2D and the code is for 3D , so i changed it and now it works (in this way at least) . Here’s my last problem :
do you think we can define which objects can change the color? like if we have a cube and a sphere , can we define that just hitting the cube should change the color of player and not the sphere ?
i tried the layering thing but then they wouldn’t hit eachother , they would go through each other!
The event OnCollisionEnter should do the trick for you. You can check every properties of an object when colliding to another. Take a look to the doc and let me know if it helped you.