I'm trying to switch scenes when an object in a VR environment is pressed. Should be a simple line of code but when I try to execute it the game crashes. The game is build to the Oculus Go.
I know I've added the scenes to the build to that shouldn't be the problem. I also got the index of '1' right in the build settings.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SphereScript : MonoBehaviour
{
public void LoadScene()
{
SceneManager.LoadScene("1");
}
}
private void ProcessTouchpadDown()
{
if (!m_CurrentObject)
return;
Interactable interactable = m_CurrentObject.GetComponent<Interactable>();
CubeScript.onVRTriggerDown();
SphereScript.LoadScene();
}
}