Class CanvasOptimizer
Keeps track of canvases in a scene and optimizes them by removing unnecessary components in nested canvases and canvases out of view.
Inherited Members
Namespace: UnityEngine .XR.Interaction.Toolkit.UI
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("Event/Canvas Optimizer", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.1/api/UnityEngine.XR.Interaction.Toolkit.UI.CanvasOptimizer.html")]
public class CanvasOptimizer : MonoBehaviour
Properties
rayFacingIgnoreAngle
How much the camera and canvas rotate away from one another and still be considered facing.
Declaration
public float rayFacingIgnoreAngle { get; set; }
Property Value
Type | Description |
---|---|
float |
rayPositionIgnoreAngle
How wide of an field-of-view to use when determining if a canvas is in view.
Declaration
public float rayPositionIgnoreAngle { get; set; }
Property Value
Type | Description |
---|---|
float |
rayPositionIgnoreDistance
How far away a canvas can be from this camera and still receive input.
Declaration
public float rayPositionIgnoreDistance { get; set; }
Property Value
Type | Description |
---|---|
float |
Methods
Awake()
See Mono
Declaration
protected void Awake()
RegisterCanvas(Canvas)
Allows the canvas optimizer to process this canvas. Will be called automatically for all canvases in the scene.
Declaration
public void RegisterCanvas(Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Canvas | canvas | The canvas to optimize. |
Remarks
This only needs to be called manually for canvases instantiated at runtime.
UnregisterCanvas(Canvas)
Tells the canvas optimizer to stop processing this canvas. Will be called automatically for all canvases in the scene.
Declaration
public void UnregisterCanvas(Canvas canvas)
Parameters
Type | Name | Description |
---|---|---|
Canvas | canvas | The canvas to stop optimizing. |
Remarks
This only needs to be called manually for canvases destroyed during runtime.
Update()
See Mono
Declaration
protected void Update()