| Parameter | Description |
|---|---|
| target | The RectTransform to test for coplanarity. |
bool
true if this RectTransform is considered coplanar with target; false otherwise.
Determines whether this RectTransform is coplanar with the given RectTransform.
Two RectTransforms are considered coplanar when their forward vectors are parallel and they share the same world-space Z position. Use this method to check coplanarity before performing custom logic that requires both RectTransforms to be on the same plane.
using System.Collections.Generic; using UnityEngine;
// Manages which world-space canvas surface is currently active. // Call SetActiveSurface when the player focuses on a different surface — // for example, when a controller ray hits a new canvas. public class SurfaceFocusManager : MonoBehaviour { [SerializeField] List<RectTransform> m_AllPanels;
public void SetActiveSurface(RectTransform focusedPanel) { foreach (RectTransform panel in m_AllPanels) { CanvasGroup group = panel.GetComponent<CanvasGroup>(); bool onActiveSurface = panel.IsCoplanarWith(focusedPanel);
// Enable interaction only for panels on the focused surface. group.interactable = onActiveSurface; group.alpha = onActiveSurface ? 1f : 0.5f; } } }