crest
crest copied to clipboard
Moving the mesh construction away from OnEnable
I'm implementing occlusion culling for the water as a decent amount of time is spend inland in my game. The problem is when I detect that I want to re-enable the OceanRender object - OceanRender.OnEnable() calls OceanRender.GenerateMesh(), which has a large cost for a real-time update. In the current state, it creates a FPS spike, making the full disabling/enabling for culling an impractical solution.
Very reasonable.
We might have to move from enable/disable to awake/destroy for resource management. And if developers want resources to be freed they'll have to destroy the OR.