using System; using System.Collections; using System.Collections.Generic; #if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; public class AssetData : ScriptableObject { #if UNITY_EDITOR [MenuItem("工具/创建资源数据")] static void CreateExampleAssetInstance() { var exampleAsset = CreateInstance(); AssetDatabase.CreateAsset(exampleAsset, "Assets/Resources/AssetData.asset"); AssetDatabase.Refresh(); } #endif public List buildData; public Dictionary buildDic = new Dictionary(); public void InitData() { foreach (var dAsset in buildData) { buildDic.Add(dAsset.icon.name,dAsset.icon); } } } [Serializable] public class ImageAsset { public string key; public Sprite icon; }