Core Methods
Public methods on the BRGRenderer singleton for runtime control.
Access the singleton via BRGRenderer.Instance.
SetGlobalDensity
public void SetGlobalDensity(float density)
Set the global density scale (0–1). Prototypes with Enable Global Density Scaling enabled on their BRG Prototype Extra Data / Density will thin out instances proportionally.
| Parameter | Type | Description |
|---|---|---|
| density | float | Density multiplier, clamped to 0–1. 1 = full density, 0 = maximum culling. |
// reduce density to 50% (e.g. as a graphics setting)
BRGRenderer.Instance.SetGlobalDensity(0.5f);
// restore full density
BRGRenderer.Instance.SetGlobalDensity(1f);
CrossfadeTimeScale
public float CrossfadeTimeScale { get; set; }
Multiplier applied to animated crossfade delta time. Default is 1f. Higher values speed up transitions, lower values slow them down. Clamped to ≥ 0.
The main use case is fast camera movement — when the camera moves quickly through the scene, instances cross LOD thresholds rapidly and a slow crossfade can become visible as visible popping. Increasing CrossfadeTimeScale shortens the transitions so they finish before the camera has moved far enough for the change to be noticeable. You can also set it to 0 to pause crossfades entirely (e.g. while the game is paused).
// speed up crossfades during fast camera movement
BRGRenderer.Instance.CrossfadeTimeScale = 2f;
// restore default
BRGRenderer.Instance.CrossfadeTimeScale = 1f;
// pause crossfades
BRGRenderer.Instance.CrossfadeTimeScale = 0f;
RuntimeRefresh
public void RuntimeRefresh()
A faster refresh path for use at runtime. Shuts down and re-initializes all active registerers, causing them to re-extract and re-upload their instance data. Use this after you have programmatically changed terrain data, swapped prefabs, or modified prototype settings at runtime.
BRGRenderer.Instance.RuntimeRefresh();
CompactBuffers
public void CompactBuffers()
Compacts the internal instance pool and chunk buffers to reduce GPU memory waste. Leaves approximately 25% headroom above current usage. This causes a small frame hitch, so call it during pauses, loading screens, or scene transitions rather than during gameplay.
// compact during a loading screen
BRGRenderer.Instance.CompactBuffers();
The Config also provides an Enable Auto Compaction option that runs compaction automatically when utilization is low, but manual compaction is recommended to prevent hitches.
SnapAllCrossfadeStates
public void SnapAllCrossfadeStates()
Snap all crossfade animations to their target LODs for all cameras. Call after teleportation or scene load to prevent a mass fade-in of all visible instances.
// after teleporting the player
player.transform.position = newPosition;
BRGRenderer.Instance.SnapAllCrossfadeStates();
SnapCrossfadeState
public bool SnapCrossfadeState(Camera camera)
public bool SnapCrossfadeState(int viewID)
Snap animated crossfade for a single camera or view. Returns false if the view has not been seen by the culling system yet.
The Camera overload is a convenience wrapper that passes camera.GetInstanceID() to the int overload.
| Parameter | Type | Description |
|---|---|---|
| camera | Camera | The camera to snap crossfade for. |
| viewID | int | The view identifier (camera instance ID or shadow view ID). |
| Returns | Description |
|---|---|
| bool | true if the view was found and snapped, false if the view ID is unknown. |
// snap crossfade for a specific camera after teleporting it
BRGRenderer.Instance.SnapCrossfadeState(myCamera);
PurgeUnusedPrototypes
public int PurgeUnusedPrototypes()
Immediately remove all prototypes with a reference count of zero, bypassing the Prototype Idle Grace Period on the Config. Returns the number of prototypes purged.
By default, unused prototypes stay alive for the grace period (default 30s) so that re-registering the same prefab during a scene transition reuses the existing GPU data with zero work. Call this method only when you want to reclaim GPU memory immediately — for example, during a memory-tight loading screen.
int purged = BRGRenderer.Instance.PurgeUnusedPrototypes();
Debug.Log($"Purged {purged} unused prototypes");
ResampleAllLightProbes
public void ResampleAllLightProbes()
Force a re-sample of legacy light probes for every active instance. Only relevant when Support Legacy Light Probes is enabled on the Config. Call this after Adaptive Probe Volumes or legacy probes are rebaked at runtime, otherwise existing instances continue using their last sampled values.
LightmapSettings.lightProbes = newProbeData;
BRGRenderer.Instance.ResampleAllLightProbes();
ShiftInstances
public void ShiftInstances(Vector3 offset)
Shift all instance positions and chunk bounds by an offset. Designed for floating world origin systems that periodically re-center the world to avoid floating-point precision issues at large coordinates.
This only shifts the BRG data — you are responsible for shifting GameObjects, terrain, cameras, and any other world-space objects separately.
| Parameter | Type | Description |
|---|---|---|
| offset | Vector3 | World-space offset to apply to all instances and chunk bounds. |
// re-center the world around the player
Vector3 shift = -player.transform.position;
BRGRenderer.Instance.ShiftInstances(shift);
// shift everything else too
player.transform.position += shift;
// ... shift terrain, cameras, etc.