Skip to content

CVR Canvas Wrapper

CVR Canvas Wrapper Whitelisted: WP

Section titled “CVR Canvas Wrapper ”

Handles setup and interaction logic for world-space canvases in ChilloutVR. Add it alongside a Canvas component to configure UI interaction properties.

If this component is not found alongside a Canvas on prop or world load, one is added automatically with default settings.

| Name | Type | Description | |-----------------------|---------|--------------------------------------------------------------------------------------------------------------------------| | interactionDistance | float | Maximum distance at which this canvas can be interacted with, measured from the hit point to the ray origin. Max 100. | | doNotTouchCollider | bool | When true, the component will not adjust an existing collider at startup. |

| Name | Type | Description | |-------------------|----------|----------------------------------------------------------| | IsCanvasEnabled | bool | Whether the canvas is active and interactable. |

| Name | Description | |---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | UpdateColliderForRenderMode() | Enables the BoxCollider only for RenderMode.WorldSpace and resizes it to match the RectTransform. |

| Name | Description | |---------------------------------------|----------------------------------------------------------------------------------------------------------------------------| | CVRCanvasWrapper.AddForLegacyCanvas | Adds a wrapper to a canvas that didn’t ship with one. The added wrapper is flagged legacy so it also adds a GraphicRaycaster. |

  • Collider Setup: Ensures a BoxCollider is present. The collider size matches the canvas sizeDelta, with a small depth (0.0125 / lossyScale.z). NaN/Infinity fallbacks are applied if the rect transform returns invalid values.
  • World camera tracking: The canvas worldCamera is reassigned to PlayerSetup.Instance.activeCam on Start and refreshed whenever the user switches between desktop and VR (VRModeSwitchEvents.OnPostVRModeSwitch).
  • Legacy fallback: If a Canvas is loaded without this component, one is added automatically at runtime.
  • CVR-GameFiles/ABI.CCK.Components/CVRCanvasWrapper.cs