Author Topic: PSA: WorldToViewportPoint used by NGUI seems to be broken  (Read 2226 times)

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
PSA: WorldToViewportPoint used by NGUI seems to be broken
« on: November 05, 2016, 05:15:30 AM »
Just wanted to give a heads up: Camera.WorldToViewportPoint seems to be returning incorrect results whenever you hold a mouse button when called from certain points in execution order, e.g. from LateUpdate on a script with execution position 0. This might be linked to the bizarre OSX issue you have already encountered and worked around of with Unity 5.4 (reported screen size going wrong whenever mouse is pressed). So far we have reproduced it on two Windows PCs with Unity 5.4.2f1. I'm not yet sure which Unity 5.4 versions beyond 5.4.2f1 it affects, haven't tested the latest patches yet.

The interesting detail about the issue is that only LateUpdate calls to Camera.WorldToViewportPoint seem to return incorrect coordinates - FixedUpdate and Update usually return proper ones (unless we're checking Update on late-executing scripts), even when the mouse is pressed. Might be worth going through NGUI code to check if there are any calls to Camera.WorldToViewportPoint from LateUpdate.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: PSA: WorldToViewportPoint used by NGUI seems to be broken
« Reply #1 on: November 05, 2016, 09:44:19 AM »
UICamera's execution order is -90, which is where events are processed -- so if this Unity bug only affects script execution order 0 scripts then NGUI isn't going to be affected. Does Unity know about this btw?