Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: col000r 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 (https://drive.google.com/file/d/0BxKfsbKFJRUKTDhPV21RSGJzbjg/view?usp=sharing)
How can I fix this?
-
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.
-
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:
(http://i.imgur.com/jH7BJIp.png)
-
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.
-
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.
-
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.