so I'm having a problem.
I'm developing a game for our final project and I'm using scene load additive to load all the scenes). So the problem is... Everything works right when I test/play the game through the editor, all scenes are load as expected with a SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive). But when I create a build, the supposed scene that should be loaded with LoadSceneAsycn doesn't show up...
I'll try to leave here some of the code used and I'll try to explain the logic
When I load the first level I'll also load the next scenes, to this purpose I've created a script that will select which scene should load next:
private void Start() {
switch (goToScene) {
case GoToScene.LABORATORY:
GameManager.ForceAsyncLoad(2);
break;
case GoToScene.GARAGE:
GameManager.ForceAsyncLoad(3);
break;
}
}
Then It will call the method ForceAsyncLoad from my GameManager which is a Coroutine:
IEnumerator LoadAsync(int sceneIndex) {
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneIndex, LoadSceneMode.Additive);
while (!operation.isDone) {
yield return null;
}
SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(sceneIndex));
Debug.Log("Scene Additive Load Completed");
}
Ok so far... This is all I'll do to load the scene additive, but for some reason on the Editor this works as expected but when I create a build it won't load.
Also, the scenes when loaded have almost all objects disabled, only one or two game objects will be active. One of them is a trigger when the character goes through it, it will enable the objects in that scene.
I'll leave here my last build log:
Mono path[0] = 'D:/UnityFinishedGames/TBA-Master-D/BetaVersion/TBA-MasterD_Data/Managed'
Mono config path = 'D:/UnityFinishedGames/TBA-Master-D/BetaVersion/MonoBleedingEdge/etc'
PlayerConnection initialized from D:/UnityFinishedGames/TBA-Master-D/BetaVersion/TBA-MasterD_Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55357
Multi-casting "[IP] 192.168.1.67 [Port] 55357 [Flags] 2 [Guid] 839978317 [EditorId] 2132102930 [Version] 1048832 [Id] WindowsPlayer(DESKTOP-H2EGAS4) [Debug] 1 [PackageName] WindowsPlayer [ProjectName] TBA-MasterD" to [225.0.0.222:54997]...
Started listening to [0.0.0.0:55357]
Starting managed debugger on port 56317
Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=0.0.0.0:56317
PlayerConnection already initialized - listening to [0.0.0.0:55357]
Initialize engine version: 2019.4.16f1 (e05b6e02d63e)
[Subsystems] Discovering subsystems at path D:/UnityFinishedGames/TBA-Master-D/BetaVersion/TBA-MasterD_Data/UnitySubsystems
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: NVIDIA GeForce GTX 1070 (ID=0x1b81)
Vendor: (null)
VRAM: 3072 MB
Driver: 30.0.14.7141
Begin MonoManager ReloadAssembly
- Completed reload, in 0.342 seconds
D3D11 device created for Microsoft Media Foundation video decoding.
<RI> Initializing input.
<RI> Input initialized.
<RI> Initialized touch support.
UnloadTime: 0.657200 ms
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 52.699800 ms
System memory in use before: 215.6 MB.
System memory in use after: 189.3 MB.
Unloading 29 unused Assets to reduce memory usage. Loaded Objects now: 11007.
Total: 51.210800 ms (FindLiveObjects: 0.710300 ms CreateObjectMapping: 0.140200 ms MarkObjects: 49.202300 ms DeleteObjects: 1.157200 ms)
The referenced script on this Behaviour (Game Object 'ExitAndTopLevelStairs') is missing!
(Filename: C:\buildslave\unity\build\Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 334)
Saving Game...
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
SaveSystemManager:SaveGame(Checkpoint, List`1) (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\SaveSystem\SaveSystemManager.cs:64)
SaveSystemManager:Save(Checkpoint, List`1) (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\SaveSystem\SaveSystemManager.cs:112)
Checkpoint:OnTriggerEnter(Collider) (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\SaveSystem\Checkpoint.cs:29)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/SaveSystem/SaveSystemManager.cs Line: 64)
You can now use the drone by pressing the key: 'Q'
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogWarning(Object)
charController:SetDroneControl(Boolean) (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Tiago\player\charController.cs:381)
ItemGiver:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Jorge\ItemGiver.cs:19)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/Tiago/player/charController.cs Line: 381)
Keys to interact: Space, to go UP and, LeftControl, to go down.
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogWarning(Object)
DroneController:OnEnable() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:190)
UnityEngine.GameObject:SetActive(Boolean)
charController:DroneControl() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Tiago\player\charController.cs:346)
charController:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Tiago\player\charController.cs:176)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/Fabio/Drone/DroneController.cs Line: 190)
DRONE::: Vent_Exit_Mesh ( View to PIT room ) (2) (VentController)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DroneController:Shoot() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:156)
DroneController:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:88)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/Fabio/Drone/DroneController.cs Line: 156)
DRONE::: Vent_Exit_Mesh (Entrance From Drone Room) (1) (VentController)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DroneController:Shoot() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:156)
DroneController:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:88)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/Fabio/Drone/DroneController.cs Line: 156)
DRONE::: ControlMachine (DoorManager)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
DroneController:Shoot() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:156)
DroneController:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Fabio\Drone\DroneController.cs:88)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/Fabio/Drone/DroneController.cs Line: 156)
On the next trigger enter is to Disable Objects? False
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
SceneSwitcher:ToogleTypeOfSwitch() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\InGameSceneManager\SceneSwitcher.cs:66)
<DisableAllObjectsAsync>d__5:MoveNext() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\InGameSceneManager\SceneController.cs:91)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/InGameSceneManager/SceneSwitcher.cs Line: 66)
Lista para Parar: 15
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
GameManager:PauseAllAudioSources() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\GameManager.cs:263)
GameManager:_SetPauseGame() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\GameManager.cs:303)
GameManager:SetPause() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\GameManager.cs:107)
charController:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Tiago\player\charController.cs:140)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/GameManager.cs Line: 263)
Game Manager: Game Paused
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
GameManager:_SetPauseGame() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\GameManager.cs:308)
GameManager:SetPause() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\GameManager.cs:107)
charController:Update() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\Tiago\player\charController.cs:140)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/GameManager.cs Line: 308)
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 36.279700 ms
Loading Game...
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
SaveSystemManager:LoadGameData() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\SaveSystem\SaveSystemManager.cs:80)
SaveSystemManager:LoadData() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\SaveSystem\SaveSystemManager.cs:123)
<LoadAsync>d__51:MoveNext() (at D:\GitHub\MasterD_FinalProject\TBA-MasterD\Assets\Scripts\GameManager.cs:380)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
(Filename: D:/GitHub/MasterD_FinalProject/TBA-MasterD/Assets/Scripts/SaveSystem/SaveSystemManager.cs Line: 80)
System memory in use before: 337.6 MB.
System memory in use after: 220.4 MB.
Unloading 559 unused Assets to reduce memory usage. Loaded Objects now: 11042.
Total: 46.406900 ms (FindLiveObjects: 0.465700 ms CreateObjectMapping: 0.138900 ms MarkObjects: 27.467400 ms DeleteObjects: 18.334200 ms)
The referenced script on this Behaviour (Game Object 'ExitAndTopLevelStairs') is missing!
(Filename: C:\buildslave\unity\build\Runtime/Mono/ManagedMonoBehaviourRef.cpp Line: 334)
Setting up 4 worker threads for Enlighten.
Thread -> id: 5130 -> priority: 1
Thread -> id: fa0 -> priority: 1
Thread -> id: b32c -> priority: 1
Thread -> id: 8f30 -> priority: 1
##utp:{"type":"MemoryLeaks","version":2,"phase":"Immediate","time":1633874119606,"processId":39884,"allocatedMemory":709939,"memoryLabels":[{"Permanent":24},{"NewDelete":220},{"Thread":68},{"Manager":2244},{"GfxThread":24},{"Physics":32},{"Serialization":24},{"String":151},{"DynamicArray":572712},{"HashMap":3072},{"PoolAlloc":32},{"Sprites":32},{"GI":130672},{"VR":1132},{"Subsystems":4294966796}]}
I also have added the scenes to the buildIndex so