void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") //If there's something in "nextRoom" in the inspector, call BeginTransitionOut() from the TransitionScript then invoke RoomChange(). //If there isn't something in "nextRoom" in the inspector, call BeginTransitionOut() from the TransitionScript then invoke TurnOnLevelCompleteUI(). { if (nextRoom != null) { TS.BeginTransitionOut(); Invoke("RoomChange", 3); } else { TS.BeginTransitionOut(); Invoke("TurnOnLevelCompleteUI", 1.5f); } } }