Search Unity

Suggestions for tracking down source of lockup?

Discussion in 'Editor & General Support' started by jeremy1967, Jun 23, 2019.

  1. jeremy1967

    jeremy1967

    Joined:
    Jun 4, 2019
    Posts:
    68
    Hi all. I am at my wits end on this one. Been dealing with seemingly random lockups during play for several weeks now (multiple platforms) and I am at a complete loss how to go about resolving.

    For the record, I've been gutting my code down to the bare minimum functionality and have even eliminated ALL my Update() and FixedUpdate() callback methods as I've read many posts identifying them as likely culprits. Not so in my case. I am 99.99% certain I have no endless loop conditions in my scripts.

    The problem appears to be related to when the user interacts with a UI button. This can be on a click or even just when mousing over. Despite dozens and dozens of debug statements, it never seems to occur at a specific point in any of my scripts (i.e. it is always between calls).

    Is there anything I can do to debug the UI of Unity? Any help is greatly appreciated as I am about ready to throw in the towel.

    Thanks.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,409
  3. jeremy1967

    jeremy1967

    Joined:
    Jun 4, 2019
    Posts:
    68
    Hey mgear. Thanks for the quick reply.

    Running logcat there is no obvious messages at the point of failure. Indeed, when the app does lock up, logcat ceases all reporting.

    The button click is basically a submit which does some score keeping based on user selection on game objects (word building tile game). It is all pretty straight forward stuff. I had various sound clips and animations paired with the scoring, but I have since commented them all out to try and narrow things down. I've been over the code numerous times looking for the possibility of endless loop conditions as you suggested and am confident (within reason) that none exist. This is what was leading me to believe I was perhaps utilizing the UI/event system improperly which was causing some behind the scenes issues not readily apparent when stepping through my scripts.

    Again, thanks for the response and I'll keep at it, but if you can think of anything else worth looking at I'm ready to do whatever it takes.
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,409
    test with try-catch around the possible problem code, so should be able to put debug.logexpection there
     
  5. jeremy1967

    jeremy1967

    Joined:
    Jun 4, 2019
    Posts:
    68
    Unfortunately, that's part of what's making this so difficult to troubleshoot. All calls to my methods complete so no exceptions are thrown that I could catch. Essentially what I've done is to put a pair of debug statements in each of my methods that are called, one as the very first line, and the other as the very last line. Both debug statements will print to the console for all of my methods. That's what I meant before when i said the problem seems to exist "between" my stuff. My gut tells me the problem originates within Unity's EventSystem class as I can see that as the initiator in the stack trace after clicking on the button (i.e. UnityEngine.EventSystems.EventSystem:Update() is what ultimately calls my method).

    My hands-on experience with the EventSystem stuff is minimal. In this case, all I did was drag a UI button into my scene which automatically added the EventSystem object to which I have made no changes. From there, I simply hooked up my Submit() method to the OnClick handler in the Unity editor. Assumed that was all there was to it.

    I would be great if I could step through the Unity code in my debugger. That might shine a light on what's going on.