Core Methods
Public methods on the BRGInstancedRenderer singleton for runtime control.
Access the singleton via BRGInstancedRenderer.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);
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.
BRGInstancedRenderer.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
BRGInstancedRenderer.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;
BRGInstancedRenderer.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
BRGInstancedRenderer.Instance.SnapCrossfadeState(myCamera);
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.