Search Unity

Doing something after all LateUpdates have been executed, "LastUpdate"?

Discussion in 'Editor & General Support' started by trappist-1, Jul 8, 2017.

  1. trappist-1

    trappist-1

    Joined:
    Mar 26, 2017
    Posts:
    497
    Unity is somehow re-positioning all of my cameras so they follow my HMD's head tracker but I absolutely require being able to control of my cameras and make it stationary/positionable. I have tried many things to prevent this behavior. And now I am looking for alternatives.

    I was wondering if there is a way to call a function after all other functions have been called and all transforms applied?

    I was hoping to find a "LastUpdate" kind of thing (or possibly "BeforeDraw") where it has final say over object transforms.

    Can anything like this be done?
     
  2. Dreamwriter

    Dreamwriter

    Joined:
    Jul 22, 2011
    Posts:
    472
    With VR, you are supposed to make the camera a child of the thing you want to move - you don’t move the camera, you move its parent. And if you want something to remain “stationary” so it follows the headset motion exactly, make it a child of the camera.

    Having said that, yes there is what you are looking for. First off, cameras have an “OnPostRender” call, put that on a script attached to the camera and it’s called right after that camera is finished rendering its stuff. Second, you can have a coroutine do a “WaitForEndOfFrame” to wait until everything is done rendering from all cameras.
     
unityunity