16 / 18
Packages/Hierarchy Organizer Pro/Editor C# & API reference
DEVELOPER REFERENCE
16 / 18

Editor C# & API reference

One complete Editor-only example and the public styling command reference.

English guideSource: Unity 6000.3.13f1 · Editor only13 October 2026

Optional automation for Editor tool developers. The namespace is ERAGANX.HierarchyOrganizerPro.Core; the assembly is ERAGANX.HierarchyOrganizerPro.Editor.

A complete selected-row command#

Save as ProjectHierarchyStyle.cs under your own Editor folder. Add an Editor assembly reference if your asmdef does not automatically reference the package. The example uses Unity selection to apply a Title recipe and reset selected own assignments.

C#
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using ERAGANX.HierarchyOrganizerPro.Core;
public static class ProjectHierarchyStyle
{
    [MenuItem("Tools/Project/Style Selected Group")]
    private static void ApplyGroup()
    {
        var targets = Selection.gameObjects;
        var style = new HierarchyStyle
        {
            role = StyleRole.Title,
            kind = RowKind.Section,
            bold = true,
            backgroundEnabled = true,
            background = new Color(0.27f, 0.48f, 0.77f),
            opacity = 1f,
            directCount = true,
            childColorScope = ChildColorScope.Descendants,
            childBackground = new Color(0.27f, 0.48f, 0.77f),
            childOpacity = 0.18f
        };
        StyleCommands.ApplyTemplate(targets, style,
            "Style selected project groups");
    }
    [MenuItem("Tools/Project/Reset Selected Row Styles")]
    private static void ResetRows()
    {
        StyleCommands.Apply(Selection.gameObjects, null,
            ApplyScope.Selection, "Reset selected styles");
    }
}
#endif

Download ProjectHierarchyStyle.cs

Keep these references outside runtime assemblies/Player code. Commands filter non-editable targets and refuse row edits in Play Mode. Save scene identities and preserve metadata. The script follows inspected guide signatures; a newly added project's compilation/visual check remains its responsibility.

Public commands#

Prefer property edits when each row's unrelated choices should remain intact.

MemberUse
StyleResolver.Resolve(go)Return resolved own/source/default style or null. Clone before direct customization.
StyleCommands.Modify(...)Modify(GameObject[], Action<HierarchyStyle>, ApplyScope = Selection, string action): edit chosen properties.
StyleCommands.Apply(...)Apply(GameObject[], HierarchyStyle, ApplyScope, string action): copy a complete style; null resets own assignments.
StyleCommands.ApplyTemplate(...)ApplyTemplate(GameObject[], HierarchyStyle, string action): apply full template and explicit child-color recipe.
StyleCommands.ModifyGroup(...)ModifyGroup(GameObject[], Action<HierarchyStyle>, bool applyChildColors, string action): property editing with optional child painting.
ClearChildColors(selected)Clear backgrounds within selected groups' remembered child-color scope.
Copy(go) / ReadClipboard()Write/read package style payload; invalid clipboard returns null.
ApplyPrefabSource(go)Assign resolved style to corresponding prefab source after customizing the object.
PresetLibraryFactory, All, Find; SaveCustom, SaveCopy, Update, Rename, Delete; Export, Parse, ImportFile.
HierarchyStyle.Clone / NormalizeClone shared data before edits; Normalize validates enums/ranges and derives horizontal gradient.

Preserve independent row choices#

C#
// In Editor code with the package and UnityEditor namespaces imported:
StyleCommands.Modify(Selection.gameObjects,
    s => { s.bold = true; s.uppercase = true; },
    ApplyScope.Selection, "Emphasize selected rows");

Scope enums#

ApplyScopeTargets
SelectionSelected target rows only.
DirectChildrenImmediate children, excluding roots.
DescendantsAll children, excluding roots.
SubtreeRoots and all descendants.

ChildColorScope has None, DirectChildren and Descendants. This controls explicit background painting, separate from full-style command scope and prefab-source inheritance.

Adapted from the supplied guide · PDF pages 29–30.View source guide ↗
Keep creating.ERAGAN STUDIO.

Search a topic, setting or method across all package guides.