Created
February 11, 2026 18:42
-
-
Save zuedev/8946c716f246abc9c718e2b56efc631d to your computer and use it in GitHub Desktop.
A utility script that adds a custom Editor window to Unity for scanning hierarchies. It quickly identifies and lists all GameObjects using Poiyomi shaders, providing one-click selection to streamline material management and avatar optimization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEditor; | |
| using System.Collections.Generic; | |
| public class PoiyomiFinder : EditorWindow | |
| { | |
| private GameObject targetObject; | |
| private List<GameObject> results = new List<GameObject>(); | |
| private Vector2 scrollPos; | |
| [MenuItem("Tools/Poiyomi Finder")] | |
| public static void ShowWindow() | |
| { | |
| GetWindow<PoiyomiFinder>("Poiyomi Finder"); | |
| } | |
| private void OnGUI() | |
| { | |
| GUILayout.Label("Search Hierarchy for Poiyomi Shaders", EditorStyles.boldLabel); | |
| targetObject = (GameObject)EditorGUILayout.ObjectField("Target Root", targetObject, typeof(GameObject), true); | |
| if (GUILayout.Button("Find Poiyomi Materials")) | |
| { | |
| FindMaterials(); | |
| } | |
| EditorGUILayout.Space(); | |
| if (results.Count > 0) | |
| { | |
| GUILayout.Label($"Found {results.Count} objects:", EditorStyles.helpBox); | |
| scrollPos = EditorGUILayout.BeginScrollView(scrollPos); | |
| foreach (GameObject obj in results) | |
| { | |
| EditorGUILayout.BeginHorizontal(); | |
| EditorGUILayout.ObjectField(obj, typeof(GameObject), true); | |
| if (GUILayout.Button("Select", GUILayout.Width(60))) | |
| { | |
| Selection.activeGameObject = obj; | |
| } | |
| EditorGUILayout.EndHorizontal(); | |
| } | |
| EditorGUILayout.EndScrollView(); | |
| } | |
| } | |
| private void FindMaterials() | |
| { | |
| results.Clear(); | |
| if (targetObject == null) return; | |
| // Get all renderers in children | |
| Renderer[] renderers = targetObject.GetComponentsInChildren<Renderer>(true); | |
| foreach (Renderer ren in renderers) | |
| { | |
| foreach (Material mat in ren.sharedMaterials) | |
| { | |
| if (mat != null && mat.shader != null) | |
| { | |
| // Check if the shader name contains "poiyomi" (case-insensitive) | |
| if (mat.shader.name.ToLower().Contains("poiyomi")) | |
| { | |
| if (!results.Contains(ren.gameObject)) | |
| { | |
| results.Add(ren.gameObject); | |
| } | |
| break; // Move to next renderer once found | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment