This commit is contained in:
SoulliesOfficial
2025-12-17 04:19:38 -05:00
parent 7c1cb7e8e1
commit d15957c719
4315 changed files with 8260710 additions and 2940 deletions

View File

@@ -0,0 +1,52 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace GraphicsCat
{
[InitializeOnLoad]
public static class LayerAutoCompleter
{
static LayerAutoCompleter()
{
EditorApplication.delayCall += () =>
{
CompleteEmptyLayers();
};
}
public static void CompleteEmptyLayers()
{
SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty layersProp = tagManager.FindProperty("layers");
bool madeChanges = false;
// Process all layers (0-31)
for (int i = 0; i < 32; i++)
{
SerializedProperty layerProp = layersProp.GetArrayElementAtIndex(i);
// Auto-name if empty
if (string.IsNullOrEmpty(layerProp.stringValue))
{
layerProp.stringValue = "Layer" + i;
madeChanges = true;
Logger.Log($"Auto-named Layer {i} as 'Layer{i}'");
}
}
if (madeChanges)
{
tagManager.ApplyModifiedProperties();
Logger.Log("All empty layers have been auto-named!");
}
else
{
// Debug.Log("All layers already have names. No changes made.");
}
}
}
}
#endif