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.

NameTypeDescription
interactionDistancefloatMaximum distance at which this canvas can be interacted with, measured from the hit point to the ray origin. Max 100.
doNotTouchColliderboolWhen true, the component will not adjust an existing collider at startup.
NameTypeDescription
IsCanvasEnabledboolWhether the canvas is active and interactable.
NameDescription
UpdateColliderForRenderMode()Enables the BoxCollider only for RenderMode.WorldSpace and resizes it to match the RectTransform.
NameDescription
CVRCanvasWrapper.AddForLegacyCanvasAdds 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