Search Unity

Windows Build - missing environment

Discussion in 'Getting Started' started by Solara1509, Jun 8, 2022.

  1. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Hello everybody,

    I'm quite new to Unity, working on a project for work. The project itself is ready and running completely fine in unity editor but when I build an .exe and start the game the whole environment is missing. The dialogue system is working well, the Canvas and UI is working well but the office building I made up, the NPCs and simply everything is gone. I am completely lost on why that is. I have watched dozens of tutorials how to build the game and read so many threads but I cannot seem to figure out where I did go wrong. Y'all have an idea what the issue may be? I also don't have a .txt file where possible failures are shown.

    I would really appreciate any kind of hints and ideas.

    Thank you
    Solara
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,977
    There is not a great deal to go with here, we will probably need to see some screenshots of what is happening and how you have set things up to troubleshoot this.

    Did you definitely include the scene in the build? (As in the scene with the environment is ticked in the build settings window)

    Also this forum is for general discussion, in future post support threads in a relevant forum section otherwise you are unlikely to get many helpful replies (if at all)
     
  3. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Hey,

    thanks for getting back to me. My apologies, I honestly thought that was kind of a general subject since I cannot really name a specific issue and wouldn't know where to address this. I would not even know what to screenshot since the settings in the build itself are correct, it must be something in the game. I just added a Start Scene to the game with some kind of user interface. When I now start it on Unity editor and it switches the scene it becomes kinda darkish. So there must be something in the game that I cannot seem to figure out.

    upload_2022-6-8_13-15-17.png
     
  4. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,977
    That looks like your lighting is super dark as there appears to be things in the background. But no, this is not a common issue so more information is better.

    Screenshot the entire build settings window if you have to, dont assume "its correct" because if something is wrong - then something is very much not correct and best not to assume what the source of the problem is without knowing.

    But this is affecting unity editor so its not a build issue, you have done something incorrect but it will be hard to tell without seeing your code, object hierarchy etc. I suggest looking into how lighting works in unity (including baked lighting) as this appears to be the source of your issue
     
  5. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Thank you. I just looked it up and checked on my lights. All of em are on real time, not baked. I'll change that and try again. Thank you so much!
     
  6. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Hello again,

    even though it is working perfectly fine in unity editor now, it won't in the.exe. Any ideas?

    upload_2022-6-8_14-41-54.png

    upload_2022-6-8_14-42-29.png

    upload_2022-6-8_14-47-27.png

    upload_2022-6-8_14-48-9.png
     
  7. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,977
    It looks like from the screenshots you posted, that for some reason the camera is not rendering / is clearing the screen / has wrong clear flags somehow, or perhaps is targeting an incorrect display target number.

    Unfortunately something like this is pretty difficult to debug from afar, so you are probably going to have to try a range of things before finding the culprit

    Can you send a screenshot of your cameras inspector (and if you have more than one camera / scene active, send a picture of your hierarchy as well) and we can start to work out if you have setup the cameras incorrectly or their culling incorrectly

    More than likely you have more than 1 active camera the second camera to become active has become your "main" camera and is not setup to look at the right stuff. Unless you are doing VR / worldspace UI, you do not need to have your user interface in a seperate scene as it appears you have done.

    Also I did not mean that you have to change to baked lights, baked lights are fundamentally different from realtime lights. I simply meant to check that if you are using baked lights, that they have baked correctly, and if you are using realtime lights that they are setup correctly and do not have too low values. You can go back to using realtime lights (although baked will give better performance).
     
  8. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Hey,

    thanks for your help! I only have one camera, it's the 1st person perspective of the player. Those are the settings:

    upload_2022-6-8_15-25-59.png
     
  9. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Sorry, second try:

    upload_2022-6-8_15-28-3.png
     
  10. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
  11. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Thank you. Yes, it's starting with the UserInterface (0) and when I click on "Start" it switches to the main Scene (1) but in the main scene itself it doesn't show the environment but only a blue background.
     
  12. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    The application generates a log file:
    https://docs.unity3d.com/Manual/LogFiles.html

    You need to find that and check if it logs an error.

    Alternatively you can create your own UI window which will print any unity log messages.
    https://docs.unity3d.com/ScriptReference/Application-logMessageReceived.html

    The likely scenario is that the main scene does not load.
     
  13. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    Thank you for the sources. My issue is, that the scene does load, the dialogue is starting like it is supposed to, somehow though the camera doesn't show the environment but a blue background.
     
  14. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    What about error messages in the log file? Did you check them?

    It sounds like when you load the scene, you end up with multiple cameras. It could happen if there's a camera in original scene, and the second one is loaded additively. Or if the first camera ends up being marked with "Dont Destroy On Load"

    After loading the scene, find all cameras in the world and count how many there are. And check the error messages.

    Alternatively, put a single immovable unscripted camera into the loaded scene, and disable the one on the player. Then see if that one works when the scene loads. If it does, it means there's a bug in t he camera control script.
     
  15. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10
    There are no error messages at all. That is why I don't even know where to start.
     
  16. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,566
    I sort of already explained it.

    Here are possible scenarios:
    1. There's more than one camera, the last one overwrites everything.
    2. There's one camera, but it is borked. (looks into the wrong direction, has layers switched off, etc).
    3. There's one camera, but all objects are actually hidden.

    And so on.

    So start eliminating possibilities.
    For example, try loading ANOTHER scene, with a cube or something. Does it show up? If it does, the problem is with your scene.
    Make a copy of your scene, and load a copy. Does it show up? No? What if you delete everything that's not level geometry?
    What if you put a static camera and disable the one attached to a player? Does it show anything? If it does, then whatever is controlling the camera is breaking it.
    You can also verify after loading the world, where the camera is at, in which direction it is looking and so on. It iS possible to accidentally put the camera into an error state where its position will read as (NaN, NaN, NaN). This will break rendering.

    And so on and so on and so on.
     
  17. Solara1509

    Solara1509

    Joined:
    Oct 18, 2021
    Posts:
    10

    Thank you for that detailed explanation. I am going to try those things!