Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Baroque · Jan 31, 2017 at 03:24 AM · uirenderingvrcanvasupdate-order

When does the UI system generate its list of draw commands?

There is (as of Unity 5.6 beta) an issue where UI elements attached to SteamVR controllers lag behind the controllers by a frame. This appears to be because the controllers' positions are updated right at the point of rendering in the OnPreCull phase.

Question is: when are the draw commands for the UI system generated?

Or to put it another way: What's the latest I can update a UI transform for it to still be drawn in the right place in a frame?

The documentation is unclear--it says that Canvas elements are drawn "after scene rendering" but that doesn't mean that's when the draw commands are generated. In fact, they obviously aren't, because other Mesh objects that are children of the SteamVR controller do get drawn in the right place.

(I should add that I can probably find a workaround for my specific problem--I'm just curious about the UI system).

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jan 31, 2017 at 04:32 AM

Well, most parts of the UI system are open source. However the Canvas itself is a built-in component. It has a private method called "SendWillRenderCanvases" which will actually trigger the update of all pending / dirty objects. Since this method is called internally by the engine itself we can't say for sure when it actually happens. We would have to do some testing to narrow it down, but that's something you can do on your own.

Btw: This method can be called manually by calling Canvas.ForceUpdateCanvases(). "ForceUpdateCanvases" is just a wrapper around "SendWillRenderCanvases()". So you can try just calling this after you did changes to your UI.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Baroque · Jan 31, 2017 at 08:45 PM 0
Share

I was hoping that someone already knew the answer! I had looked at the source to the UI system but, like you say, it's relying on the Canvas and it's not clear exactly when that updates.

If I do some testing I'll update with whatever I find out. Canvas.ForceUpdateCanvases() is a great tip though, I'll check to see if it works in this case. Thanks!

Edit to add: Calling Canvas.ForceUpdateCanvases() in OnPreCull() seems to have no effect. $$anonymous$$oving the transform update to LateUpdate() works (obviously).

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

116 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't position instantiated objects on canvas 2 Answers

Raw image not visible in overlay canvas 0 Answers

World Space Canvas renders over everything : Vive Focus 3 1 Answer

How do Image shaders interact with UI Canvas draw order? 0 Answers

LineRender width not consistent across resolutions 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges