MonoBehaviourExtensions

Extension methods for UnityEngine.MonoBehaviour that provide convenience APIs for managing Unity HideFlags on both the component and its owning GameObject.

Definition

Namespace: Paragon Assembly: Paragon.dll

public static class MonoBehaviourExtensions

Quick Lookup

Goal
Method

Hide from Hierarchy and Inspector

behaviour.SetHideFlags(true, true)

Show in Hierarchy, hide in Inspector

behaviour.SetHideFlags(false, true)

Show everywhere

behaviour.SetHideFlags(false, false)

Methods

SetHideFlags

Sets the visibility flags for a MonoBehaviour's GameObject (hierarchy visibility) and the component itself (Inspector visibility) independently.

public static void SetHideFlags(this MonoBehaviour behaviour, bool hideInHierarchy, bool hideInInspector)
Parameter
Type
Description

behaviour

MonoBehaviour

The target MonoBehaviour

hideInHierarchy

bool

If true, adds HideFlags.HideInHierarchy to the GameObject. If false, removes it.

hideInInspector

bool

If true, adds HideFlags.HideInInspector to the component. If false, removes it.

circle-info

This method uses bitwise flag operations (|= to add, &= ~ to remove), preserving any other HideFlags already set on the object. It does not reset flags — it only toggles the specific hierarchy and inspector flags.

circle-exclamation

See Also

Last updated