通过序列表存储所有用到的组件和属性:
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;
}
}
}
然后通过对象名/组件名查找。