Hi there. Again.
So, if I have 10,000 objects in a scene, a very big scene, how, or what’s the best way to turn off components on objects at distance? I can do it by script checking a vector3.distance, I suppose I’m asking if this can be automated? Or even how does Unity decide not to evaluate objects at distance?
Thanks.
What kinds of components are you talking about? The main thing people turn off at a distance are the renderers for objects, so the game doesn’t bother drawing something that’s too far away. You can accomplish that using LOD. Even just a two-level LOD would work in this case, where objects beyond a certain distance just stop being drawn.
But turning other kinds of components off at a distance can be very problematic. What if you turned off a collider because it was far away, and now objects fall through the floor? What if you turn off some AI agent, and now a character ends up where he shouldn’t be. Maybe you can be more specific about the kinds of components you want to turn on/off, unless it’s just renderers.