Search Unity

Question Event lag

Discussion in 'Editor & General Support' started by woodsmic, Jan 17, 2023.

  1. woodsmic

    woodsmic

    Joined:
    Jan 5, 2018
    Posts:
    12
    Hi,

    I just updated from unity 2018 to 2020.3.43

    The PointerDown Event trigger now seems to have lag before the code is executed, around 0.1 to 0.2 of a second.

    Playing the game in the editor still seems fine, but when running the game on android the lag really presents itself.

    Since my games are skill based, this event needs to be very quick executing my code. In Unity 2018 and below, there was no lag.

    My game is now pretty much unplayable when built in Unity 2020.

    Any ideas?

    Thanks, Mike.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,697
    Sounds like maybe you're doing too much in FixedUpdate()?

    You should only do the bare minimum of physics-only updates there, and do 100% of everything else in Update().
     
  3. woodsmic

    woodsmic

    Joined:
    Jan 5, 2018
    Posts:
    12
    Hi,

    Thanks for your reply.

    It's a 2d game, not using any physics and with very low cpu usage. I dont have anything in update() or fixedupdate(), this is simply using the event system pointerdown.

    I can recreate the problem in a simple new project, using 10 images that light up in turn over 1 second, with a button to stop the light. Pressing the button with code on pointerdown does not stop the light where the button was pressed. There is definately some lag of at least 0.1 seconds.

    Worked perfectly in serveral versions of Unity ive been using since 2014.