Initial commit

This commit is contained in:
HussienX72u
2026-07-21 08:56:10 +03:00
commit 4017028111
9410 changed files with 2150500 additions and 0 deletions
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using HierarchyIcons;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
using UnityEngine.SceneManagement;
// https://forum.unity.com/threads/excluding-certain-monobehaviour-classes-from-build.568090/#post-3779695
public class DestroyInstancesOnBuild : MonoBehaviour
{
[PostProcessScene]
public static void DeleteObjects()
{
if (BuildPipeline.isBuildingPlayer)
{
Type type = typeof(HierarchyIcon);
Debug.Log("Destroying all instances of '" + type.Name + "' from scenes on build!");
foreach (Component obj in FindObjectsOfTypeAll(type, true))
DestroyImmediate(obj);
}
}
static List<Component> FindObjectsOfTypeAll(Type type, bool findInactive = false)
{
List<Component> results = new List<Component>();
for (int i = 0; i < SceneManager.sceneCount; i++)
{
Scene scene = SceneManager.GetSceneAt(i);
if (scene.isLoaded)
{
GameObject[] allGameObjects = scene.GetRootGameObjects();
for (int j = 0; j < allGameObjects.Length; j++)
{
GameObject go = allGameObjects[j];
results.AddRange(go.GetComponentsInChildren(type, findInactive));
}
}
}
return results;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e80715f9811a6ab449fc1b6403f5bf27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
using HierarchyIcons;
using UnityEngine;
using UnityEditor;
namespace CGHierarchyIconsEditor
{
[InitializeOnLoad]
public class ShowIconOnHierarchyView
{
const float MAX_ICON_SIZE = 16;
static ShowIconOnHierarchyView()
{
EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemCallback;
}
static void HierarchyWindowItemCallback(int instanceID, Rect selectionRect)
{
GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (gameObject == null)
return;
HierarchyIcon[] hierarchyIcons = gameObject.GetComponents<HierarchyIcon>();
foreach (HierarchyIcon hierarchyIcon in hierarchyIcons)
{
Texture2D icon = hierarchyIcon.icon ? hierarchyIcon.icon : TextureHelper.NO_ICON;
float width = Mathf.Min(icon.width, MAX_ICON_SIZE);
float height = Mathf.Min(icon.height, MAX_ICON_SIZE);
// get the starting x position based on the direction
float x = selectionRect.x;
if (hierarchyIcon.direction == HierarchyIcon.Direction.LeftToRight)
x += hierarchyIcon.position * MAX_ICON_SIZE;
else
x += (selectionRect.width - width) - hierarchyIcon.position * MAX_ICON_SIZE;
// draw the icon
Rect rect = new Rect(x, selectionRect.y, width, height);
GUI.DrawTexture(rect, icon);
// set link cursor
EditorGUIUtility.AddCursorRect(rect, MouseCursor.Link);
// and draw a button for change the icon and display the tooltip
if (GUI.Button(rect, new GUIContent(string.Empty, hierarchyIcon.tooltip), EditorStyles.label))
PopupWindow.Show(rect, new PickIconWindow(hierarchyIcon));
}
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f9de4623bd5b3274985a8f32e6007ff9
timeCreated: 1516518841
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: