Unity直接获取Panel下所用到的所有对象

通过序列表存储所有用到的组件和属性:

namespace UIA
{
    public class ItemHandle : MonoBehaviour
    {
        [SerializeField]
        public List<ItemSave> Saves = new List<ItemSave>();      
    }
    [System.Serializable]
    public struct ItemSave
    {
        [SerializeField]
        public string Path;
        [SerializeField]
        public List<ItemFile> Comps;
        [SerializeField]
        public List<string> Names;
        public ItemSave(string Path, List<ItemFile> Comps, List<string> Names)
        {
            this.Path = Path;
            this.Comps = Comps;
            this.Names = Names;
        }
    }
 
    [System.Serializable]
    public struct ItemFile
    {
        [SerializeField]
        public string Comp;
        [SerializeField]
        public List<string> Attri;
        [SerializeField]
        public List<string> Names;
        public ItemFile(string Comp, List<string> Attri, List<string> Names)
        {
            this.Comp = Comp;
            this.Attri = Attri;
            this.Names = Names;
        }
    }
}

然后通过对象名/组件名查找。

—— 完 ——
相关推荐
评论

立 为 非 似

中 谁 昨 此

宵 风 夜 星

。 露 , 辰

文章点击榜

细 无 轻 自

如 边 似 在

愁 丝 梦 飞

。 雨 , 花