Hi All,
Can you please help me to troubleshoot this issue? I am fairly new to Unity and this forum. I tried to fix this myself but with no success. I use Unity 2020.1.4f1 and VisualStudio Version 16.7.3.
I have a simple game scene called “Game1”. It’s a 3D open world with terrain and character which can move in the open world. The scene is working fine, however I want to put it into a multi-scene environment with this simple functionality:
The initial scene is simple with one object and loads the first scene which is the game load screen. It’s a simple Canvas with background color and one Button to start New Game - load scene Game1. There is also a Camera to view the canvas when the scene is loaded.
Inside of the Game1 scene I am checking for ESC button press on the keyboard which loads the Game user interface - scene GameUI. This is again a simple scene with Canvas and button “Exit to Main Menu”. There is another dedicated Camera to view the canvas when this scene is loaded.
-
Scene - GameManager: Contains object “Manager” with assigned script “LoadScenes.cs”. This just loads the next scene “LoadUI”
-
Scene - LoadUI: There is a Canvas with NewGame button, with component Event Trigger > Pointer up which triggers the game object LoadNewGame. To this game object is attached the second script “LoadGame.cs”. The PointerUp triggers the LoadGame.LoadGameScene(string). The string is “Game1”.
-
Scene - Game1: I will just describe the part which controls the load of next scene. In the Game1 scene there is an object “GameControl” with assigned script “MainGameControl.cs”. This script just checks user input on keyboard for ESC key. If the key is pressed the next scene is loaded “GameUI”.
-
Scene - GameUI: This is as simple as the Load UI. Canvas, button “Exit to Main Menu”, camera to view the scene and control object “UiController” with assigned script “GameUiController.cs”. The button has the component Event Trigger which calls > GameUiController.BackToMainMenu(string). The String is “LoadUI”, the second Scene name.
This is where the problem occurs. The LoadUI just does not load. I would like to add the Exit game option in this scene…
Notes:
- I have added all scenes to BuildSettings
- I have tried to assign the OnClick event directly to the button
- I have tried SceneManager.LoadSceneAsync(string)
- I have tried SceneManager.LoadScene(string, LoadSceneMode.Additive)
Any of these didn’t help. Everything works fine until the last step. When I click on button “Exit to Main Menu” the first scene “LoadUI” just does not load. Can you please help me figure out what can be the issue? I can provide any additional details if necessary.
PS - I have reviewed all the above mentioned details multiple times but all seems to be properly configured and scripted but the last load just does not work.
Thanks in advance!
6348762–705657–LoadScenes.cs (550 Bytes)
6348762–705666–LoadGame.cs (361 Bytes)
6348762–705672–MainGameControl.cs (597 Bytes)
6348762–705708–GameUiController.cs (464 Bytes)