Hello everyone, I have three scenes in my project - one for the main menu, one for the map and the game itself and one for the loading screen between the game and the main menu. I’m trying to make it so when I hit the button Play on the main menu, the scene switches to the loading screen and a script attached to the camera immediately starts loading the scene with the map with LoadSceneAsync.
When I try the game, I expect to switch to the loading screen scene after i hit the button Play on the main menu. Then the loading screen scene should stay on until the playable scene with the map loads and switches.
Unfortunately, I get completely different results - after I hit Play, the game freezes (as it does with the normal LoadScene function) until the scene with the map loads. Then it switches to the loading screen scene for a second and then to the scene with the map.
This is the code that is compiled when the button Play on the main menu is pressed:
public void Play()
{
SceneManager.LoadScene("LoadingScreen");
PresenceManager.UpdatePresence(detail: "Exploring Ancient Greece",start: System.DateTimeOffset.Now.ToUnixTimeSeconds());
Cursor.visible = false;
}
This is the script attached to the camera in the loading screen scene which responds for loading the map scene with LoadSceneAsync:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadingLevel : MonoBehaviour
{
void Start()
{
SceneManager.LoadSceneAsync("SampleLevel");
}
}
Do you have any ideas on what I am doing wrong and how to fix it. Any help would be appreciated.