CullingGroup API

由于使用 CullingGroups 并不总是非常简单,因此将大量逻辑封装在管理器类后面可能会有所帮助。

以下是这样一位经理如何运作的蓝图。

using UnityEngine;
using System;
public interface ICullingGroupManager
{
    int ReserveSphere();
    void ReleaseSphere(int sphereIndex);
    void SetPosition(int sphereIndex, Vector3 position);
    void SetRadius(int sphereIndex, float radius);
    void SetCullingEvent(int sphereIndex, Action<CullingGroupEvent> sphere);
}

它的要点是你从管理器中保留一个剔除球体,它返回保留球体的索引。然后使用给定的索引来操作保留的球体。