Search Unity

Framerate dropout on first run only

Discussion in 'Android' started by TheMonkeysaur, Jan 7, 2021.

  1. TheMonkeysaur

    TheMonkeysaur

    Joined:
    May 2, 2017
    Posts:
    52
    I'm having a weird experience with sudden short framerate drops, and they only occur the first time a trigger2D is run, AND they no longer occur upon scene reload IF the trigger was triggered during the previous playthrough. (Running on Android)

    For example.

    Open app, start game >
    trigger2D No.1 = YES momentary framerate drop/stutter.
    trigger2D No.2 = YES momentary framerate drop/stutter.
    Reload scene >
    trigger 2D 1 & 2 = NO momentary framerate drop/stutter.

    But if:

    Open app, start game >
    trigger2D No.1 > = momentary framerate drop/stutter
    trigger2D No.2 NOT TRIGGERED
    Reload scene >
    trigger2D No.1 = NO momentary framerate drop/stutter.
    trigger2D No.2 = momentary framerate drop/stutter.

    I'm hoping that this very particular framerate dropout behavior might be giving a big clue about what the problem is or where I should be investigating it?

    The fact that I can run the entire scene with zero problems, as long as the triggers have occured once before during this running of the app suggests to me that there is something I can do to fix this and it isn't a case of my code being fundementally broken.

    If anyone reads this and has an idea what could cause this to happen, please let me know.

    Thanks in advance.
     
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    My guess would be, that it has nothing to do with the trigger itself, but what you do with the trigger. Are you activing anything (and therefore running Start methods of the monobehaviour)? Or maybe it has to do with shader compilation, if you're showing any new materials or something like that?

    I guess to be able to help, we would need more information what happens when running those triggers.