How do I check if bool is true from another script? [Solved]

hi
How do I check if bool is true from another script?

///
testscript.cs
public bool testrue= false;

void Update ()

{ if(,…)
{
testrue= true;
}
}
///

*.cs
if (GameObject.GetComponent().testrue== true) {

Debug.Log(“test script”);

}

And this dont work wtf

dont work i think this dont work on unity 5 i tested it looks like it only work on unity 4

Shouldn’t it be gameObject instead of GameObject?

what ??
gameobject it correct auto so its GameObject

Edit: Solved ^^
Its very very easy i forgot to drag and drop the gameobject with the other code :roll_eyes:
Now working ^^
In unity4 it was in ^^ unity 5 i forgot it because i dont scroll down and dont see it ^^

Glad you solved it. :slight_smile:

1 Like