I have a scene with lots of billboards (10.000+). There is occlusion- and per-layer culling going on. When most of the billboards are in view frustum the frame rate is about 30FPS. I am wondering why the frame rate remains low when the cam isn´t moving. What would be an appropiate method to let the scripts fall asleep if the cam is not turned?
Currently I am using LateUpdate() and if (renderer.isVisible). Here the code:
using UnityEngine;
using System.Collections;
public class CameraFacingBillboard_up : MonoBehaviour
{
public Camera m_Camera;
How many draw calls are being made when you are seeing the 30FPS? (You can see them by turning on the Stats in the Game window of the editor)
My guess is that your low frame rate isn’t related to script processing but rather GUI processing. One way to improve that performance is to reduce the number of draw calls being made by combining meshes and combining materials. Using static batching may be an option if your billboards are repeating a lot of the same static textures.
I’m far from an expert on this aspect of Unity, but this will hopefully help as a starting point.
Having 10K LateUpdate calls on 10K objects is a massive amount of overhead. You should use something more specific to this sort of thing like a particle system.