Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity collapse hierarchy script

using UnityEditor;
using UnityEngine;

internal class MyClass : EditorWindow
{
    private void OnGUI()
    {
        using (var scope = new EditorGUI.DisabledGroupScope(Selection.activeGameObject == null))
        {
            if (GUILayout.Button("Expand Recursive"))
            {
                var type = typeof(EditorWindow).Assembly.GetType("UnityEditor.SceneHierarchyWindow");
                var window = GetWindow(type);
                var exprec = type.GetMethod("SetExpandedRecursive");
                exprec!.Invoke(window, new object[] {Selection.activeGameObject.GetInstanceID(), true});
            }
        }
    }

    [MenuItem("TEST/TEST")]
    private static void Init()
    {
        GetWindow<MyClass>();
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# try parse date yyyymmdd 
Csharp :: c# .net core entity framework one to many 
Csharp :: c# if string in licbox 
Csharp :: unity mouse button names 
Csharp :: Ignore case string linq c# 
Csharp :: unity stop physics 
Csharp :: wpf keydown detect if control key is down 
Csharp :: Unity upload image to project 
Csharp :: c# while true loop 
Csharp :: c# get executing file name 
Csharp :: raq query ef core 
Csharp :: how to use open hardware monitor in c# 
Csharp :: do while loop in c# 
Csharp :: factorial of number 
Csharp :: c# list get last element 
Csharp :: C# Change color 
Csharp :: c# bool list count true 
Csharp :: linq select to list 
Csharp :: c# textbox kodu 
Csharp :: c# datetime 
Csharp :: by value by reference c# 
Csharp :: c# how to get a securestring from string 
Csharp :: animation not playing unity 
Csharp :: list contains type c# 
Csharp :: access denied tring to save a file uwp xamarin 
Csharp :: C# ToCsv Extension Method 
Csharp :: jq map over array 
Csharp :: convert string to float win forms 
Csharp :: optional parameter get request c# 
Csharp :: unity repeat coroutine 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =