Can you tell me how to access a variable of a script from another script? I have even read everything in unity website but I still can’t do it. I know how to access another object but not another variable.
This is the situation: I’m in script B and I want to access the variable X from script A. The variable X is boolean. Can you help me?
Btw i need to update X’s value constantly in script B, how do I do that? Access it in Update function If you could give me an example with these letters would be great!
Thank you
int foo = GetComponent<YourScript>().YourVariableaccessthe variable from the other script. So how can Ichangethe other variable on the other script?isAlive=trueboolean. I want to change it tofalsefrom scriptA?