Search Unity

Question Game freezing between scenes...

Discussion in 'Editor & General Support' started by CatDadJynx, Apr 17, 2021.

  1. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Hello, i have a main menu scene, a scene to load my main scene (using async loading), then my main scene... everything works fine in the editor but when i put it on hardware it freezes once my loading bar reaches 100%. I have a debug output for my memory and should have plenty to work with so really have no idea why this is happening. Ive read that loading the scene additively might help but to be honest have no idea why, and since it would break all my references if i do that and id have to do a ton of scriping to fix it im hesitant to go through all the trouble just for it to not work. Can anyone help me out here and please explain why this may or may not be a good idea? Been stuck on this for going on 3 weeks now already and cant find anything online to give me an answer. Thanks
     
  2. What 'freezes' means exactly? Crashes? Or just stays on the loading bar with low/average CPU usage? Maybe you have an error and your new scene can't be activated properly? Have you checked the logs?
     
  3. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Everything runs fine in the Unity editor with no errors, but the hardware im using will completely freeze up so it requires a hard reset, though some of the time it will work and load the next scene fine (but it freezes more often than not). Unfortunately my output on the hardware is limited but im able to see usable ram/vram/rom, and seem to have plenty of room to work with for all of them (no spike before it freezes or anything).
     
  4. You need to figure out how to read/produce the logs and/or run profiler or debugger. It's unlikely that anyone can help you based on this very limited information. Maybe drivers, maybe you have an infinite loop somewhere, maybe something completely different.
     
  5. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Great. Just about ready to give up on this after a year of getting nowhere anyway trying to use this busted ass software. Guess this is just what i get for trying to do literally anything, i swear lmao. Thanks anyway.
     
  6. I'm not sure I understand what you're talking about. If you want to find your bug/problem, you need to investigate. This is how software engineering works. You can't just wait around and expect any solutions.

    Using profiler and debugger is a very common task in software development. If you don't accept it, you won't be happy making any kind of software, including games.
     
    Kurt-Dekker likes this.
  7. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Ive been trying to do both. I can't run the profiler on the hardware im using but in the editor it looks fine. Im looking at the output log when i run in the editor and after each build but cant see anything pointing to any issue (or probably just dont understand it enough to know what the hell im even looking for). Im not sure how much infomation i can even give about it to find help since its proprietary, but no one at the company whos hardware im using can tell me anything because its not specific enough to the hardware (even though it is). So basically this whole thing is a joke and seems to have been a massive year long waste of my time lmao.
     
  8. Well, if you can't use the proper toolset, you always can go rouge and debug "manually".
    - Replace the loaded scene with an empty one.
    - Build and check if it's freezes (you will know that your problem isn't related to the content of the new scene)
    -- if it's not the new scene, make your loading and menu scene super-dumb and try it), if it fixes, you'll know something is wrong with the main menu/loading
    - you can then add your stuff one by one until you experience the freeze, you will at least have any idea where the problem is (unless it is truly hardware, like faulty storage or memory or something)
     
    Kurt-Dekker likes this.
  9. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,739
    What about other hardware? What about building it for web and running it?

    If it's just a lockup, odds are it's just an infinite loop in your code and that's just basic debugging 101.

    I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

    Doing this should help you answer these types of questions:

    - is this code even running? which parts are running? how often does it run?
    - what are the values of the variables involved? Are they initialized?

    Knowing this information will help you reason about the behavior you are seeing.

    If you are running a mobile device you can also see the console output. Google for how.
     
  10. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Will definitely try that, at least should help me narrow down where the issue might be, thanks!
     
    Lurking-Ninja likes this.
  11. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    I havent targeted any other hardware because that would require learning/changing large amounts of code and would be incredibly time consuming, unfortunately. And i don't have access to console output on the hardware im using, the extent of this platforms debugging is through a separate license and hardware (so i can't use the profiler either), but will keep that in mind with the debug log moving forward. Maybe just start over at this point if i can't diagnose where the issue is since my game has gotten pretty complex and i kind of lost track when the issue actually started not testing it on hardware with every single change i made along the way, maybe just start over from the ground up using more debug log outputs i guess. Thanks!
     
  12. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,739
    What on earth do you mean?! Are we talking about the Unity3D engine here?! It's like one setting in Edit -> Build Settings. There isn't a faster game engine on this ENTIRE PLANET as far as switching between target hardware!

    Or just try the project on another machine of the same type.

    This is a strategy, but rarely the best one.

    Instead try refactoring. It will enable you to revisit what you have done and improve it. There have been rivers of digital ink spilled on all the ways to refactor code and there are plenty of tools available (such as the profiler, the debugger, and just good old Debug.Log) to narrow down your problem.
     
  13. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Ideally, but the platform im using can't use the input manager so i had to script all my inputs. And i dont have access to another development kit either, unfortunately.

    And the company who provided the hardware intentionally made debugging a pain in the ass so youd have to use their debug license/kit (im only using a test unit so my debug options are limited to debug log output on the actual hardware) but Ill try to look more into that for the editor and see if that tells me anything, thanks
     
  14. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,739
    If it's a console, all hardware is likely to behave the same anyway.
     
  15. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249
    Ok i think i may actually have an idea where the problem is now, just not *what* the problem is... Looking at the profiler thru the editor i see a spike when i transition scenes telling me my CPU usage is at 90%, and this screenshot tells me where that is, but i can't seem to figure out why this is happening/what this means (or how i might fix it).
     

    Attached Files:

  16. CatDadJynx

    CatDadJynx

    Joined:
    Apr 16, 2020
    Posts:
    249