- Home /
Using events to change variables and inherit that value?
I made a scene where you click on a button that executes a function where you change the value of a bool to true. The script where I've declared and changed the value of the variable is inherited by another script which is supposed to debug the value. For some reason even when I click on the button the value stays the same. The scripts are on two separate object. Is it possible to fix this and if so can I do it with event triggers?
Sounds to me as if you've forgotten to call the base method, but you'd need to provide code to verify.
And yes, event trigger is just the same as the buttons click event.
public class One : $$anonymous$$onoBehaviour
{
internal bool bul = false;
public void Function()
{
bul = true;
}
}
public class Two : One
{
private void Update()
{
Debug.Log(bul);
}
}
So Two is attached to the button or whatever gameobject and the button is setup to call it's Function?
$$anonymous$$aybe you exchanged One with Two and didn't set the Function again?