Search Unity

Bug Input not working on some scenes (builds only)

Discussion in 'Editor & General Support' started by bwulff, Sep 25, 2021.

  1. bwulff

    bwulff

    Joined:
    Jun 20, 2020
    Posts:
    12
    Hello everyone,

    The problem is simple:
    Every scene I create works flawlessly on editor and some scenes have this weird issue on builds that it doesn't detect any input.

    I have to create a new scene, and a new one, and another until it works on builds.

    I already reported a bug 20 days ago (Case 1363191).

    The thing is I'm making a Metroidvania and I need to create a lot of scenes every single day and it's driving me nuts because instead of simply creating it and setting up the enironments on the editor, I have to create and debug them all on builds, almost 50% of the new scenes will not work, then I have to fix them, build again and it goes on and on.

    Any clue of what might be causing this thing is valid.
    I already tried a couple of things like deleting all scenes from build settings and messing around with scripts order but no luck.
    Already tried updating unity since I'm running on a M1 macbook air, no luck too.

    I'm running Unity 2021.1.19f1 and I have 0 compile errors / warnings.
    I'm using the "new" Input System.

    Thanks in advance.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    What are you doing that fixes them?? If it fixes them, is it a Unity problem or are you neglecting some important step?

    Also, all your main game input should really only be handled in one (or very few) scenes, then each of hundreds of scenes can be additively loaded only as a "content" scene, to avoid cloning effort between scenes.

    This is how to use additive scene loading:

    https://forum.unity.com/threads/right-way-for-performance-divide-scene.1023673/#post-6630961
    https://forum.unity.com/threads/right-way-for-performance-divide-scene.1023673/#post-6754330

    https://forum.unity.com/threads/problem-with-canvas-ui-prefabs.1039075/#post-6726169

    A multi-scene loader thingy:

    https://pastebin.com/Vecczt5Q

    My typical Scene Loader:

    https://gist.github.com/kurtdekker/862da3bc22ee13aff61a7606ece6fdd3

    Other notes on additive scene loading:

    https://forum.unity.com/threads/removing-duplicates-on-load-scene.956568/#post-6233406

    Timing of scene loading:

    https://forum.unity.com/threads/fun...ject-in-the-second-scene.993141/#post-6449718

    Also, if something exists only in one scene, DO NOT MAKE A PREFAB out of it. It's a waste of time and needlessly splits your work between two files, the prefab and the scene, leading to many possible errors and edge cases.

    Two similar examples of checking if everything is ready to go:

    https://forum.unity.com/threads/daily-events-and-content-changes.1108202/#post-7143713

    https://forum.unity.com/threads/uni...on-before-other-scripts.1153739/#post-7401794
     
  3. bwulff

    bwulff

    Joined:
    Jun 20, 2020
    Posts:
    12

    Thank you for your super in depth reply!

    1. The fix is random - I need to create new scenes until one of them works on builds too...

    I'll check out everything you linked on your reply.
    The way I'm handling my scenes is:
    Each scene have basic prefabs:

    LEVEL
    - UI
    - Game Manager
    - Global Light
    - Global Volume
    - Save Manager

    PLAYER

    TRIGGERS
    - Scene Loader <doors>
    - Dialogue Trigger
    - Save Trigger

    And that's it.

    I create a new scene, than I drag those few PREFABS into it, I unpack the TRIGGERS because it's used on different world spaces for each scene and I build the level on grids.

    The game runs smoothly with no FPS drops anywhere, even where I have a lot of real lights and particles and this issue never happens on editor, it's super weird.

    Thanks again for your time, I'll have a look on all the links you send and try to change some things.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
  5. bwulff

    bwulff

    Joined:
    Jun 20, 2020
    Posts:
    12
  6. samhain323

    samhain323

    Joined:
    Aug 4, 2020
    Posts:
    10
    did you ever figure this out? I'm having the same problem