Search Unity

[Solved] "Scenes In Build" completely ignored

Discussion in 'Editor & General Support' started by uwdlg, Jul 24, 2019.

  1. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    150
    Hi,

    I have been pulling my hair out about this weird build problem I'm having, asking here in hope that somebody has an idea what I could try: I have a big, multi-scene project and when I try to build, the scene selection from the build settings seems to be completely ignored.

    No matter what I select there, the built player always starts with a scene "Player_Scene" only containing my (OVR) camera. Normally, I load that scene on top of whatever main scene I want via LoadSceneMode.Additive, so I have whatever scene I want as startup scene in the first spot with index 0 and that scene in second place. The weird thing is, that the built player always loads the "Player_Scene", even if it's unchecked or completely missing from the build scenes list.

    I read somewhere, that some NetworkManager overrides the default startup scene, so thinking that something similar might be happening with the Oculus stuff, I tried moving the OVR camera and other stuff from my "Player_Scene" into the scene I'm actually trying to have as startup scene in my build and rebuilt with only that scene checked (and being the only entry in the scenes list), but then I only get a grey screen after the Unity logo (Player log doesn't have any errors). Does somebody have any idea what I could try to fix this?

    I tried clearing that scenes list multiple times, switched to a different platform and back, switched my Unity version from 2018.2 to 2019.1, deleted everything in Library/ and anything seemingly build settings related in ProjectSettings/ all to no avail and am now completely out of ideas.

    Help please, this is driving me insane!
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please show a screenshot of your Build dialog.
     
  3. uwdlg

    uwdlg

    Joined:
    Jan 16, 2017
    Posts:
    150
    Sorry for not responding earlier, I was sure that the build dialog would be of no help and soon after posting my question I took a break from the student research assistant job this was in relation to. Now after coming back and taking a fresh look at the problem, I found its source:
    I use an Editor script listening for the EditorSceneManager.sceneOpened event to additively load my "Player_Scene" when switching scenes in the Editor, just like I do at runtime. When building my scenes, this script was triggered during the build process and messed up the scene selection.
    So now I simply use the callbacks from IPreprocessBuildWithReport and IPostprocessBuildWithReport to deactivate that script immediately before the build process and reactivate it after.