public virtual void UpdateUICacheRefence() { if (Application.isPlaying) { return; } m_ImageSetting.m_SpritePath = UICachTool.GetPrefabPath(m_ImageSetting.m_SpritePrefab.gameObject); }
// 当组件改变时候调用 protected virtual void OnValidate() { if (Application.isPlaying) return; SetMarkTag(); if (m_ReferenceCacheUIPrefab != null) { string path = UnityEditor.AssetDatabase.GetAssetPath(m_ReferenceCacheUIPrefab); if (string.IsNullOrEmpty(path)) { Debug.LogError("请关联Project 中 Resource 路径下的缓存UI预制体 ::" + gameObject.name); return; } m_LoadPrefabPath = UICachTool.GetPrefabRelativePath(path, "Resources/"); }//自动更新 m_LoadPrefabPath 路径 }
/// <summary> /// 更新缓存UI的信息 /// </summary> public void UpdateRelativeCachePath() { if (Application.isPlaying) { return; } m_CachePrefabName = gameObject.name; m_AssetPath = UnityEditor.AssetDatabase.GetAssetPath(gameObject); if (string.IsNullOrEmpty(m_AssetPath)) { Debug.LogError("当前脚本必须挂载在Projct 视图中资源上 " + this.GetType()); return; } //在Hierachy 视图中的挂载这个脚本会崩掉 m_RelativeCachePath = UICachTool.GetPrefabRelativePath(m_AssetPath, "Resources/"); }
public override void UpdateUICacheRefence() { base.UpdateUICacheRefence(); m_ButtonSetting.m_DisabledSpritePath = UICachTool.GetPrefabPath(m_ButtonSetting.m_DisabledSpritePrefab.gameObject); }