- Home /
Determining How Many Objects are Rendered by the Main Camera
Hi Everyone, how do you control how many objects are rendered by the Main Camera? I want to set it so it only renders gameobjects within a certain distance. How can this be done?
Answer by robertbu · Jun 19, 2013 at 03:55 AM
While not a purely distance, you can set the far clip plane for the camera:
http://docs.unity3d.com/Documentation/ScriptReference/Camera-farClipPlane.html
Or just add a script to all the game objects you want to be distance bound. Put something like this in Update():
renderer.enabled = Vector3.Distance(Camera.main.position, transform.position) < someDistance);
Your answer
Follow this Question
Related Questions
Making a game object un-render or turn-invisible through trigger? 1 Answer
A node in a childnode? 1 Answer
Making changes to a terrian in game 1 Answer
How to create 3D game object in specified pixel size? 2 Answers
How to add Forces and Torques relative to an object at a none central position 2 Answers