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
|
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.