KS.Unity.Editor.ksEditorUtils Class Reference

Editor utilities More...

Static Public Member Functions

static void FocusInspectorWindow ()
 Focuses the inspector window. Opens it if it is not already open. More...
 
static void RefreshInspectorWindow (bool rebuildInspectors=false)
 Refreshes the inspector window. More...
 
static EditorWindow FindWindow (string className)
 Finds a window of a type from the UnityEditor namespace if it is open. More...
 
static UnityEngine.Object[] FindWindows (string className)
 Finds all open windows of a type from the UnityEditor namespace. More...
 
static EditorWindow OpenWindow (string className)
 Opens a window of a type from the UnityEditor namespace. More...
 
static void CenterWindow (EditorWindow window, float width=400f, float height=150f)
 Resizes and centers a window in the center of the Unity editor. More...
 
static Rect GetEditorPosition ()
 Gets the position of the Unity editor in screen pixels. More...
 
static bool SetDefineSymbol (string symbol)
 Sets a define symbol for the current build target. More...
 
static bool ClearDefineSymbol (string symbol)
 Clears a define symbol for the current build target. More...
 
static T GetPropertyValue< T > (SerializedProperty property, UnityEngine.Object target=null)
 Gets the value of a serialized property using reflection. More...
 
static string GetUnityUserId ()
 Get the Unity user's account ID More...
 
static string GetUnityUserDisplayName ()
 Gets the Unity user's display name. More...
 
static string GetReleaseId ()
 Get the Unity package release ID More...
 

Properties

static bool IsUnityFocused [get]
 Is Unity the focused application? More...
 

Detailed Description

Editor utilities

Member Function Documentation

◆ CenterWindow()

static void KS.Unity.Editor.ksEditorUtils.CenterWindow ( EditorWindow  window,
float  width = 400f,
float  height = 150f 
)
static

Resizes and centers a window in the center of the Unity editor.

Parameters
windowwindow to center.
widthwidth for the window in pixels.
heightheight for the window in pixels.

◆ ClearDefineSymbol()

static bool KS.Unity.Editor.ksEditorUtils.ClearDefineSymbol ( string  symbol)
static

Clears a define symbol for the current build target.

Parameters
symbolsymbol to clear
Returns
true if the define symbol was removed. False if it was not defined.

◆ FindWindow()

static EditorWindow KS.Unity.Editor.ksEditorUtils.FindWindow ( string  className)
static

Finds a window of a type from the UnityEditor namespace if it is open.

This can be used to get instances of internal Unity windows.

Parameters
classNamename of editor window class to find instance of.
Returns
window, or null if the window wasn't found.

◆ FindWindows()

static UnityEngine.Object [] KS.Unity.Editor.ksEditorUtils.FindWindows ( string  className)
static

Finds all open windows of a type from the UnityEditor namespace.

This can be used to get instances of internal Unity windows.

Parameters
classNamename of editor window class to find instances of.
Returns
windows of the given class name.

◆ FocusInspectorWindow()

static void KS.Unity.Editor.ksEditorUtils.FocusInspectorWindow ( )
static

Focuses the inspector window. Opens it if it is not already open.

◆ GetEditorPosition()

static Rect KS.Unity.Editor.ksEditorUtils.GetEditorPosition ( )
static

Gets the position of the Unity editor in screen pixels.

Returns
position of the Unity editor.

◆ GetPropertyValue< T >()

static T KS.Unity.Editor.ksEditorUtils.GetPropertyValue< T > ( SerializedProperty  property,
UnityEngine.Object  target = null 
)
static

Gets the value of a serialized property using reflection.

Parameters
propertyproperty to get value from.
targettarget object to get property value from. If null, uses the property target.
Returns
value of the property.

◆ GetReleaseId()

static string KS.Unity.Editor.ksEditorUtils.GetReleaseId ( )
static

Get the Unity package release ID

Returns
UUID for the current package release

◆ GetUnityUserDisplayName()

static string KS.Unity.Editor.ksEditorUtils.GetUnityUserDisplayName ( )
static

Gets the Unity user's display name.

Returns
Display name

◆ GetUnityUserId()

static string KS.Unity.Editor.ksEditorUtils.GetUnityUserId ( )
static

Get the Unity user's account ID

Returns

◆ OpenWindow()

static EditorWindow KS.Unity.Editor.ksEditorUtils.OpenWindow ( string  className)
static

Opens a window of a type from the UnityEditor namespace.

If a window of the type is already open, returns it. This can be used to open internal Unity windows.

Parameters
classNamename of editor window class to open.
Returns
window, or null if the window could not be opened.

◆ RefreshInspectorWindow()

static void KS.Unity.Editor.ksEditorUtils.RefreshInspectorWindow ( bool  rebuildInspectors = false)
static

Refreshes the inspector window.

Parameters
rebuildInspectorsif true, inspectors will be rebuilt.

◆ SetDefineSymbol()

static bool KS.Unity.Editor.ksEditorUtils.SetDefineSymbol ( string  symbol)
static

Sets a define symbol for the current build target.

Parameters
symbolsymbol to define.
Returns
true if the define symbol was added. False if it was already defined.

Property Documentation

◆ IsUnityFocused

bool KS.Unity.Editor.ksEditorUtils.IsUnityFocused
staticget

Is Unity the focused application?