/** Engages level completion when the goal object is touched. * * @param other Collider */ void OnTriggerEnter(Collider other) { if (other.gameObject.name == goalColliderName) { pauseCanvas.gameObject.SetActive(true); // unlock next level persistenceController.UnlockLevel(SceneManager.GetActiveScene().buildIndex + 1); GameObject mkHolder = GameObject.FindWithTag("PlayerHolder"); if (mkHolder != null) { // if desktop mode is active, use functionality from MK_MenuControl mkHolder.GetComponentInChildren <MK_MenuControl>().ToggleMenu("Panel_Done"); } else { // otherwise use CanvasModule pauseCanvas.GetComponent <CanvasModule>().SetActivePanel("Panel_Done"); } } }