using UnityEngine;
using UnityEditor;
using System;
using System.Reflection;
using UnityEditorInternal;
public class LuoXiaoLongEditerTool : MonoBehaviour {
static void TestLuo()
{
SerializedProperty sortinglayer = null;
var tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
sortinglayer = tagManager.FindProperty("m_SortingLayers");
//var tag = sortinglayer.GetArrayElementAtIndex(3);
//var layerNameList = new List<string>();
for(int i=0; i<sortinglayer.arraySize; i++)
{
var tag = sortinglayer.GetArrayElementAtIndex(i);
Debug.Log(tag.depth) ;
}
}
[MenuItem("CMD/Luo")]
static void GetSortingLayerNames()
{
Type t = typeof(InternalEditorUtility);
PropertyInfo prop = t.GetProperty("sortingLayerNames", BindingFlags.Static | BindingFlags.NonPublic);
string[] x=(string[])prop.GetValue(null, null);
foreach(string ms in x)
{
Debug.Log(ms);
}
}
}
编辑sortingLayer
最新推荐文章于 2023-12-22 23:27:34 发布