I was trying to access UnityEngine.SceneManagement namespace in order to use LoadScene() functions, but when using SceneManager.LoadScene, VSCode doesn’t recognize it, and Unity brings up a compilation error as a result. The manual still lists this function as valid API, so I don’t know how it wouldn’t work.
Can you post an example of your code?
using UnityEngine;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour
{
public enum Scene
{
redButton,
tileGame
}
public void ChangeScene(Scene scene)
{
switch (scene)
{
case Scene.redButton:
SceneManager.LoadScene("TileGame");
break;
case Scene.tileGame:
SceneManager.LoadScene("SampleScene");
break;
}
}
}
Works fine for me.
What is the exact compile error you’re getting?