public void Interact(PlayerController pc, int flag) { if (SceneChange) //if this door loads a new scene { try { Debug.Log("Loading: " + sceneToLoad); Open(); if (ConnectedDoorID != -1) { ProgressManager.SetSceneDoor(sceneToLoad, ConnectedDoorID); } ProgressManager.DeactivatePlayerPhysics(); AsyncOperation op = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneToLoad, UnityEngine.SceneManagement.LoadSceneMode.Single); } catch (Exception e) { Debug.LogError(e.Message); } return; } if (state == 0) { Open(); state = 1; } else { Close(); state = 0; } }