Class EditorUtils
Syntax
public static class EditorUtils
Methods
Consumes mouse input events. Call this at the end of a GUI window draw function to block clicking
on controls behind the window.
Declaration
public static void ConsumeMouseInput()
GetActiveSceneAsset()
Get the SceneAsset representing the active scene
Declaration
public static SceneAsset GetActiveSceneAsset()
Returns
| Type |
Description |
| SceneAsset |
The active SceneAsset
|
GetAssetPreview(Object, Action<Texture>)
Tries to get an asset preview. If one is not available, waits until IsLoadingAssetPreview is false, and if
preview is still not loaded, returns the result of AssetPreview.GetMiniThumbnail
Declaration
public static IEnumerator GetAssetPreview(Object asset, Action<Texture> callback)
Parameters
| Type |
Name |
Description |
| UnityEngine.Object |
asset |
The asset for which to get a preview
|
| Action<Texture> |
callback |
Called with the preview texture as an argument, when it is available
|
Returns
| Type |
Description |
| IEnumerator |
An enumerator used to tick the corutine
|
GetFieldInfoFromProperty(SerializedProperty)
Declaration
public static FieldInfo GetFieldInfoFromProperty(SerializedProperty property)
Parameters
| Type |
Name |
Description |
| SerializedProperty |
property |
|
Returns
GetMemberAttributes(SerializedProperty)
Declaration
public static Attribute[] GetMemberAttributes(SerializedProperty property)
Parameters
| Type |
Name |
Description |
| SerializedProperty |
property |
|
Returns
GetMemberInfoFromPropertyPath(Type, String, out Type)
Declaration
public static MemberInfo GetMemberInfoFromPropertyPath(Type host, string path, out Type type)
Parameters
Returns
Declaration
public static string GetTooltip(this SerializedProperty property)
Parameters
| Type |
Name |
Description |
| SerializedProperty |
property |
|
Returns
| Type |
Description |
| String |
Tooltip specified in the property's TooltipAttribute, if it has one. Otherwise returns an empty string.
|
MaskField(Rect, GUIContent, Int32, String[], Type)
Special version of EditorGUI.MaskField which ensures that only the chosen bits are set. We need this version of the
function to check explicitly whether only a single bit was set.
Declaration
public static int MaskField(Rect position, GUIContent label, int mask, string[] displayedOptions, Type propertyType)
Parameters
| Type |
Name |
Description |
| Rect |
position |
|
| GUIContent |
label |
|
| Int32 |
mask |
|
| String[] |
displayedOptions |
|
| Type |
propertyType |
|
Returns
NicifySerializedPropertyType(String)
Declaration
public static string NicifySerializedPropertyType(string type)
Parameters
| Type |
Name |
Description |
| String |
type |
|
Returns
SerializedPropertyToField(SerializedProperty)
Declaration
public static FieldInfo SerializedPropertyToField(SerializedProperty property)
Parameters
| Type |
Name |
Description |
| SerializedProperty |
property |
|
Returns
SerializedPropertyToType(SerializedProperty)
Guess the type of a SerializedProperty and return a System.Type, if one exists.
The guess is done by checking the type of the target object and iterating through its fields looking for
one that matches the property name. This may return null if you give it a SerializedProperty that
represents a native type with no managed equivalent
Declaration
public static Type SerializedPropertyToType(SerializedProperty property)
Parameters
| Type |
Name |
Description |
| SerializedProperty |
property |
The SerializedProperty to examine
|
Returns
| Type |
Description |
| Type |
The best guess type
|
ToggleClassIcons(Dictionary<Int32, KeyValuePair<String, Boolean>>)
Declaration
public static void ToggleClassIcons(Dictionary<int, KeyValuePair<string, bool>> enabledStates)
Parameters
ToggleCommonIcons(Boolean, Dictionary<Int32, KeyValuePair<String, Boolean>>)
Declaration
public static void ToggleCommonIcons(bool enabled, Dictionary<int, KeyValuePair<string, bool>> classIconEnabledStates)
Parameters
TypeNameToType(String)
Search through all assemblies in the current AppDomain for a class that is assignable to UnityObject and matches the given weak name
TODO: expose internal SerializedProperty.ValidateObjectReferenceValue to remove his hack
Declaration
public static Type TypeNameToType(string name)
Parameters
| Type |
Name |
Description |
| String |
name |
Weak type name
|
Returns
| Type |
Description |
| Type |
Best guess System.Type
|