# IsCoplanarWith(RectTransform)

> Determines whether this RectTransform is coplanar with the given RectTransform.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.7/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public bool IsCoplanarWith(RectTransform target)
```

### Parameters

**** (\[RectTransform]\(/engine/6000.7/script-reference/unityengine/recttransform)): The RectTransform to test for coplanarity.

### Returns

| Type                                                          | Description                                                                       |
| ------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | true if this RectTransform is considered coplanar with `target`; false otherwise. |

### Remarks

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.

### Examples

```csharp
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;
        }
    }
}
```
