public static void ShowWindow(DynamicAtlasGroup mGroup) { if (_DynamicAtlasWindow == null) { _DynamicAtlasWindow = GetWindow <DynamicAtlasWindow>(); } _DynamicAtlasWindow.Show(); _DynamicAtlasWindow.Init(mGroup); _DynamicAtlasWindow.titleContent.text = "PackingAtlas"; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); UIDynamicRawImage myScript = (UIDynamicRawImage)target; GUILayout.Space(5); EditorGUILayout.LabelField("--------------------------------------------------------------------------------------------------------------------"); GUILayout.Space(5); myScript.mGroup = (DynamicAtlasGroup)EditorGUILayout.EnumPopup("Group", myScript.mGroup); EditorGUILayout.LabelField("Texture Path", myScript.currentPath); GUILayout.Space(5); if (EditorApplication.isPlaying) { if (GUILayout.Button("Show DynamicAtlas")) { DynamicAtlasWindow.ShowWindow(myScript.mGroup); } } else { if ((lastTexture != myScript.texture) || (myScript.texture != null && myScript.currentPath == null)) { lastTexture = myScript.texture; string path = AssetDatabase.GetAssetPath(myScript.texture); myScript.currentPath = path; } if (myScript.texture == null) { lastTexture = null; myScript.currentPath = null; } else { if (String.IsNullOrEmpty(myScript.currentPath)) { string path = AssetDatabase.GetAssetPath(myScript.texture); // Debug.Log($"myScript.currentPath:{myScript.currentPath} path:{path}"); myScript.currentPath = path; } } } EditorGUILayout.LabelField("--------------------------------------------------------------------------------------------------------------------"); EditorGUILayout.LabelField("--------------------------------------------------------------------------------------------------------------------"); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); UIDynamicImage myScript = (UIDynamicImage)target; GUILayout.Space(5); EditorGUILayout.LabelField("--------------------------------------------------------------------------------------------------------------------"); GUILayout.Space(5); myScript.mGroup = (DynamicAtlasGroup)EditorGUILayout.EnumPopup("Group", myScript.mGroup); //EditorGUILayout.LabelField("Texture Path", myScript.currentPath); GUILayout.Space(5); if (EditorApplication.isPlaying) { if (GUILayout.Button("Show DynamicAtlas")) { DynamicAtlasWindow.ShowWindow(myScript.mGroup); } } else { if ((lastTexture != myScript.sprite) || (myScript.sprite != null && myScript.currentPath == null)) { lastTexture = myScript.sprite; string path = PathUtil.RemoveResourcePath(AssetDatabase.GetAssetPath(myScript.sprite)); myScript.currentPath = path; } if (myScript.sprite == null) { lastTexture = null; myScript.currentPath = null; } } EditorGUILayout.LabelField("--------------------------------------------------------------------------------------------------------------------"); EditorGUILayout.LabelField("--------------------------------------------------------------------------------------------------------------------"); }