Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from uurha/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
uurha committed Dec 9, 2022
1 parent 0b2c99e commit 95c14cc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions Editor/EditorAddons/Helpers/EditorPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ public class EditorPopup : EditorWindow
public event Action Closed;
public event Action FocusLost;

public static EditorPopup Initialize(Texture texture, Rect position, bool needUpdate, bool destroyTexture = false)
public event Action Destroyed;

public static EditorPopup Initialize(Texture texture, Rect position, bool needUpdate,
bool destroyTexture = false)
{
var window = HasOpenInstances<EditorPopup>() ? GetWindow<EditorPopup>() : CreateInstance<EditorPopup>();
window.position = position;
Expand All @@ -22,8 +25,9 @@ public static EditorPopup Initialize(Texture texture, Rect position, bool needUp
window.ShowPopup();
return window;
}

public static EditorPopup InitializeAsWindow(Texture texture, Rect position, bool needUpdate, bool destroyTexture = false)

public static EditorPopup InitializeAsWindow(Texture texture, Rect position, bool needUpdate,
bool destroyTexture = false)
{
var window = HasOpenInstances<EditorPopup>() ? GetWindow<EditorPopup>() : CreateInstance<EditorPopup>();
window.position = position;
Expand Down Expand Up @@ -51,6 +55,11 @@ private void OnLostFocus()
FocusLost?.Invoke();
}

private void OnDestroy()
{
Destroyed?.Invoke();
}

public static void CloseInstance()
{
if (!HasOpenInstances<EditorPopup>()) return;
Expand All @@ -60,6 +69,7 @@ public static void CloseInstance()
{
Destroy(window._texture);
}

window.Close();
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.uurha.betterattributes",
"displayName": "Better Attributes",
"version": "0.2.6",
"version": "0.2.7",
"unity": "2018.3",
"description": "Unity attributes, allows to serialize interfaces, draw handles for Vector3/Vector2/Quaternion/Bounds, create read only fields.",
"dependencies": {
Expand Down

0 comments on commit 95c14cc

Please sign in to comment.