I have implemented this code and it works but i wanna make this work only if i enter the trigger and press the UI button. Right now it is changing scene automatically so, i want to press the button and then change scene. I know how to do this for PC game but not on Android game. I hope you can give me a hand.
Script
public class ButtonScript : MonoBehaviour {
//public Button btn;
private bool door = false;
public bool hasCollided = false;
public void Update () {
if(door == true){
SceneManager.LoadScene("InventoryScene");
//SceneManager.LoadScene ("Scene1AToBathW");
//Application.LoadLevel("Courtyard1F");
//gameObject.transform.position = new Vector3(x,y,z);
}
}
public void OnTriggerEnter(Collider other){
if(other.tag == "Player"){
//btn.gameObject.Setactive(true);
door = true;
hasCollided = true;
}
}
public void OnTriggerExit(Collider other){
if(other.tag == "Player"){
//btn.gameObject.Setactive(true);
door = false;
hasCollided = false;
}
}
}