Hi, I’m rather new to unity and C#.
I am trying to set up something that will allow me to toggle a material assigned to a box collider on/ off.
Basically I have a boolean variable assigned to my Player called IsBlue.
I then have a box collider assigned to my Ground object. Within this box collider I have assigned a material which will make my player bounce when in contact with it.
What I want to do is switch these bouncing physics on/off depending on if my IsBlue variable is set to true or not.
For example If IsBlue is set to false then the box collider should be enabled. If IsBlue = True then the box collider should be disbaled.
I’m pretty sure this is a simple task however i’m new to C# and can’t make sense of anything I’ve found online. There seems to be examples but no explanation of how to use the example.
I understand the concept of coding but am unfamilliar with the syntax. I essentially need to know:
How to reference the IsBlue Bool from my other Player.cs Script and how to then create an if Statment to get the results above.
Could anyone help?
Thanks.