Created
September 28, 2018 20:25
-
-
Save stella3d/8f514e495adb4b18dd765ae96af7fc00 to your computer and use it in GitHub Desktop.
check if a window resource exists without creating it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
public static class FindWindow | |
{ | |
[MenuItem("Debug/FindWindow")] | |
public static bool DoesWindowExist() | |
{ | |
var windowType = typeof(SceneView); // substitute with your own type | |
var allInstances = Resources.FindObjectsOfTypeAll(windowType); | |
if (allInstances.Length > 0) | |
{ | |
Debug.Log("found window of type: " + windowType); | |
return true; | |
} | |
Debug.Log("did not find window of type: " + windowType); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment