GameObject.active performance

I’m investigating different ways of dealing with large terrains on iPhone.
I used the almighty fractscape to generate my terrain and exported it to .obj. Next, I use Cinema4D to chop that large object into smaller parts.
I then bring in those parts into Unity and instantiate them.

Using occlusion culling, I’m getting pretty smooth results. So far so good.

Next, I was wondering if I could do better than occlusion culling myself, by setting up some box colliders to activate/deactivate certain sectors of the terrain as the player moves around. In the editor, this works perfectly. On the iPhone however, it also works, but I’m seeing a huge stall when I toggle the GameObject’s active property: 0.5 to 1 second, the app looks frozen. Obviously not acceptable.

Is this “normal” or am I doing something wrong? I have marked the terrain as ‘static’ and occlusion culling is also still enabled, would that impact it? Is there a better way to do this?

Thanks,

Niels

W00t!

Have you tried toggling the renderer between enabled/disabled, instead of the gameobject being active/inactive? I’m guessing the stalls are due to mesh colliders being actived/deactivated, assuming that’s what you’re using.

–Eric

You guessed right: it’s working very smoothly now with just toggling the renderer.

Thanks!

Niels

I’m getting comparable results with both methods, but perhaps that’s because my test environment is pretty basic: it’s just terrain, no props.

What is the best practice for doing this kind of thing on iPhone? Should I simply rely on occlusion culling or is it better to do it “manually”?

Regards,

Niels