Log in or register to post comments

Object position not set when OnTargetFound event is fired

Unity Editor
June 23, 2022 - 12:29am #1

Hello!

I am currently working on a project where we need to use the position of a tracked object only once when it is tracked. To achieve this we tried using the OnTargetFound event. But it seems like on the frame where OnTargetFound is called, the position of the tracked object is not yet updated. If we add a .25 second delay to updating the position it looks like its working most of the time.

Is there any way to get an event when the position of a tracked object is first updated? Waiting for an arbitrary amount of time seems hacky... And it feels like there should be another way.

Has anyone any ideas on how to achieve this?

Thanks!

Platform: 

Object position not set when OnTargetFound event is fired

July 1, 2022 - 6:54am #2

Hey there,

 

Great question. I believe that the position is updated 1 frame after the event fires. Could you fire a coroutine to wait for 1 frame and check the position? I believe that would be a cleaner process than an Invoke of some kind. Let me know! 

 

Kind regards,

Patrick Scheper

Technical Community Manager

Log in or register to post comments