Author Topic: NGUI Lags behind Vive Controller  (Read 3280 times)

col000r

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 3
  • Posts: 43
  • Mighty Emperor of Planet "Home Office"
    • View Profile
    • BLACKISH
NGUI Lags behind Vive Controller
« on: January 26, 2016, 06:06:22 AM »
Hi, I'm trying to put some GUI onto an HTC Vive Controller and for some reason it lags behind when I move the controller.
I also put a little sphere mesh on it and that moves with it perfectly.

Have a look: I took a video

How can I fix this?

Games: BLACKISH | Blog | Assets

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Lags behind Vive Controller
« Reply #1 on: January 26, 2016, 07:38:05 AM »
Check your script execution order. Make sure NGUI's widgets, panels and UICamera are executed after your other code.

In the latest Pro version you can also change the NGUI event code to run in the LateUpdate() instead of Update(), though I don't think that'll help you here.

mathiassoeholm

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 35
    • View Profile
Re: NGUI Lags behind Vive Controller
« Reply #2 on: August 13, 2016, 12:11:52 PM »
I'm sorry to revive an old topic, but I have the exact same problem.
I've tried changing the execution order as mentioned, but it doesn't change anything.

Here's a screenshot of my execution order:

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Lags behind Vive Controller
« Reply #3 on: August 13, 2016, 04:11:13 PM »
Check what function SteamVR uses. If it's LateUpdate, it will still fire after all other updates.

Also, shouldn't it execute everything after UI updates in this case? Your own code that deals with input should execute first. Drawing and UI should happen last.

mathiassoeholm

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 35
    • View Profile
Re: NGUI Lags behind Vive Controller
« Reply #4 on: August 13, 2016, 05:54:33 PM »
From the last post in this thread, it sounds like they're setting the position in OnPreCull.

http://forum.unity3d.com/threads/canvas-not-following-parent-properly-confirmed-fix-in-5-5.415946/

And apparently the same problem exists with Unity UI.

So since they're using OnPreCull, I guess changing the script execution order won't help since OnPreCull is always after LateUpdate.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Lags behind Vive Controller
« Reply #5 on: August 17, 2016, 07:06:48 AM »
Yeah, that's the problem then. I wonder what genius thought OnPreCull was a good idea?

You can try forcing NGUI to use OnPreCull as well, then the script execution order will work. Just change LateUpdate to OnPreCull.