- Home /
Question by
RAULRAMO002 · Jul 07, 2021 at 01:25 PM ·
boolgame window
Script does not work properly only on Maximise On Play setting,Script not working properly only on maximise on play setting
I have created a door opening/closing mechanic. I am using a bool named "avalabile" to check if the player is in proximity of the door. When I test the game it works properly except when I test it on "Maximise On Play" game window. I have managed to pinpoint where my script fails. The avalabile bool stays stuck on false if I test my game on "Maximise on Play".
Here's the code sample:
public void CallObjectController() {
Debug.Log("Inside function");
Debug.Log(avalabile);
if (avalabile == true)
{
Debug.Log("Inside if()");
objectController.GetComponent<DoorBehaviour>().DoorFunction();
}
}
Also this part :
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player") {
playerObject = other.gameObject;
avalabile = true;
Debug.Log("Inside Trigger");
}
}
Anyone have any idea of why this happens, and how to fix it? Thanks a lot in advance!
Comment