Dynamic IPD & Out Of Memory Problem
I've created a system to dynamically alter the IPD such that when a close object is under a fixed distance it will smoothly adjust the IPD down to accommodate for the objects distance and allow it to remain in focus.
I need this for ZVR which is a zombie game that has zombies getting really close to your face.
Now the good thing is this actually works really well, but I have found one problem and that is when you change the IPD a new 'Mesh' is created for the barrel distortion and the previous one doesn't get cleaned up. Since I am doing this every frame when the system is active, Unity ends up crashing out of memory.
I think I worked out why; if the IPD changes the UpdateCameraDirtyFlag gets set to true and it calls an update to the camera configuration which ends up at OVRDistortionMesh.GenerateMesh()
Is it not possible to update the existing mesh if there is one, rather than create a brand new one?
I need this for ZVR which is a zombie game that has zombies getting really close to your face.
Now the good thing is this actually works really well, but I have found one problem and that is when you change the IPD a new 'Mesh' is created for the barrel distortion and the previous one doesn't get cleaned up. Since I am doing this every frame when the system is active, Unity ends up crashing out of memory.
I think I worked out why; if the IPD changes the UpdateCameraDirtyFlag gets set to true and it calls an update to the camera configuration which ends up at OVRDistortionMesh.GenerateMesh()
Is it not possible to update the existing mesh if there is one, rather than create a brand new one?
