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?
Hi @Save_Screen ,
Could you please create a Bug report with a small reproduction project attached (a small version of your project that is causing you this issue, so we could reproduce it in-house). To create the bug report, please go to “Help” > “Report a Bug…” and fill in all of the required fields (the project should get attached automatically but you can double-check in the “Attached files” section).
After that’s done, please reply here or DM me personally via Unity Discussions with a link to your Bug report.
Kind regards,
Rokas
Customer QA Team
Just sent in the report.
https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-93753