Class CoreEditorUtils
Utility class for Editor
Namespace: UnityEditor.Rendering
Syntax
public static class CoreEditorUtils
Properties
buildTargets
Build targets
Declaration
public static GraphicsDeviceType[] buildTargets { get; }
Property Value
Type | Description |
---|---|
GraphicsDeviceType[] |
Methods
CheckOutFile(Boolean, Object)
Declaration
public static void CheckOutFile(bool VCSEnabled, Object mat)
Parameters
Type | Name | Description |
---|---|---|
Boolean | VCSEnabled | |
UnityEngine.Object | mat |
CreateGameObject(GameObject, String, Type[])
Create a game object
Declaration
public static GameObject CreateGameObject(GameObject parent, string name, params Type[] types)
Parameters
Type | Name | Description |
---|---|---|
GameObject | parent | The parent |
String | name | The wanted name (can be updated with a number if a sibling with same name exist |
Type[] | types | Required component on this object in addition to Transform |
Returns
Type | Description |
---|---|
GameObject | The created object |
CreateGameObject(String, Object)
Creates a new GameObject and set it's position to the current view
Declaration
public static GameObject CreateGameObject(string name, Object context)
Parameters
Type | Name | Description |
---|---|---|
String | name | the name of the new gameobject |
UnityEngine.Object | context | the parent of the gameobject |
Returns
Type | Description |
---|---|
GameObject | the created GameObject |
DrawEnumPopup(SerializedProperty, Type, GUIContent)
Draw an EnumPopup handling multiEdition
Declaration
public static void DrawEnumPopup(SerializedProperty property, Type type, GUIContent label = null)
Parameters
Type | Name | Description |
---|---|---|
SerializedProperty | property | |
Type | type | |
GUIContent | label |
DrawFixMeBox(String, Action)
Draw a Fix button
Declaration
public static void DrawFixMeBox(string text, Action action)
Parameters
Type | Name | Description |
---|---|---|
String | text | Displayed message |
Action | action | Action performed when fix buttom is clicked |
DrawHeader(GUIContent)
Draw a header
Declaration
public static void DrawHeader(GUIContent title)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | title | Title of the header |
DrawHeader(String)
Draw a header
Declaration
public static void DrawHeader(string title)
Parameters
Type | Name | Description |
---|---|---|
String | title | Title of the header |
DrawHeaderFoldout(GUIContent, Boolean, Boolean, Func<Boolean>, Action)
Draw a foldout header
Declaration
public static bool DrawHeaderFoldout(GUIContent title, bool state, bool isBoxed = false, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | title | The title of the header |
Boolean | state | The state of the header |
Boolean | isBoxed | [optional] is the eader contained in a box style ? |
Func<Boolean> | hasMoreOptions | [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. |
Action | toggleMoreOptions | [optional] Callback call when advanced button clicked. Should be used to toggle its state. |
Returns
Type | Description |
---|---|
Boolean | return the state of the foldout header |
DrawHeaderFoldout(String, Boolean, Boolean, Func<Boolean>, Action)
Draw a foldout header
Declaration
public static bool DrawHeaderFoldout(string title, bool state, bool isBoxed = false, Func<bool> hasMoreOptions = null, Action toggleMoreOption = null)
Parameters
Type | Name | Description |
---|---|---|
String | title | The title of the header |
Boolean | state | The state of the header |
Boolean | isBoxed | [optional] is the eader contained in a box style ? |
Func<Boolean> | hasMoreOptions | [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. |
Action | toggleMoreOption | [optional] Callback call when advanced button clicked. Should be used to toggle its state. |
Returns
Type | Description |
---|---|
Boolean | return the state of the foldout header |
DrawHeaderToggle(GUIContent, SerializedProperty, SerializedProperty, Action<Vector2>, Func<Boolean>, Action)
Draw a header toggle like in Volumes
Declaration
public static bool DrawHeaderToggle(GUIContent title, SerializedProperty group, SerializedProperty activeField, Action<Vector2> contextAction = null, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | title | The title of the header |
SerializedProperty | group | The group of the header |
SerializedProperty | activeField | The active field |
Action<Vector2> | contextAction | The context action |
Func<Boolean> | hasMoreOptions | Delegate saying if we have MoreOptions |
Action | toggleMoreOptions | Callback called when the MoreOptions is toggled |
Returns
Type | Description |
---|---|
Boolean | return the state of the foldout header |
DrawHeaderToggle(String, SerializedProperty, SerializedProperty, Action<Vector2>, Func<Boolean>, Action)
Draw a header toggle like in Volumes
Declaration
public static bool DrawHeaderToggle(string title, SerializedProperty group, SerializedProperty activeField, Action<Vector2> contextAction = null, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null)
Parameters
Type | Name | Description |
---|---|---|
String | title | The title of the header |
SerializedProperty | group | The group of the header |
SerializedProperty | activeField | The active field |
Action<Vector2> | contextAction | The context action |
Func<Boolean> | hasMoreOptions | Delegate saying if we have MoreOptions |
Action | toggleMoreOptions | Callback called when the MoreOptions is toggled |
Returns
Type | Description |
---|---|
Boolean | return the state of the foldout header |
DrawMultipleFields(GUIContent, SerializedProperty[], GUIContent[])
Draw a multiple field property
Declaration
public static void DrawMultipleFields(GUIContent label, SerializedProperty[] ppts, GUIContent[] lbls)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | label | Label of the whole |
SerializedProperty[] | ppts | Properties |
GUIContent[] | lbls | Sub-labels |
DrawMultipleFields(String, SerializedProperty[], GUIContent[])
Draw a multiple field property
Declaration
public static void DrawMultipleFields(string label, SerializedProperty[] ppts, GUIContent[] lbls)
Parameters
Type | Name | Description |
---|---|---|
String | label | Label of the whole |
SerializedProperty[] | ppts | Properties |
GUIContent[] | lbls | Sub-labels |
DrawPopup(GUIContent, SerializedProperty, String[])
Draw a popup
Declaration
public static void DrawPopup(GUIContent label, SerializedProperty property, string[] options)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | label | the label |
SerializedProperty | property | The data displayed |
String[] | options | Options of the dropdown |
DrawSplitter(Boolean)
Draw a splitter separator
Declaration
public static void DrawSplitter(bool isBoxed = false)
Parameters
Type | Name | Description |
---|---|---|
Boolean | isBoxed | [Optional] add margin if the splitter is boxed |
DrawSubHeaderFoldout(GUIContent, Boolean, Boolean, Func<Boolean>, Action)
Draw a foldout header
Declaration
public static bool DrawSubHeaderFoldout(GUIContent title, bool state, bool isBoxed = false, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | title | The title of the header |
Boolean | state | The state of the header |
Boolean | isBoxed | [optional] is the eader contained in a box style ? |
Func<Boolean> | hasMoreOptions | [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. |
Action | toggleMoreOptions | [optional] Callback call when advanced button clicked. Should be used to toggle its state. |
Returns
Type | Description |
---|---|
Boolean | return the state of the foldout header |
DrawSubHeaderFoldout(String, Boolean, Boolean, Func<Boolean>, Action)
Draw a foldout header
Declaration
public static bool DrawSubHeaderFoldout(string title, bool state, bool isBoxed = false, Func<bool> hasMoreOptions = null, Action toggleMoreOptions = null)
Parameters
Type | Name | Description |
---|---|---|
String | title | The title of the header |
Boolean | state | The state of the header |
Boolean | isBoxed | [optional] is the eader contained in a box style ? |
Func<Boolean> | hasMoreOptions | [optional] Delegate used to draw the right state of the advanced button. If null, no button drawn. |
Action | toggleMoreOptions | [optional] Callback call when advanced button clicked. Should be used to toggle its state. |
Returns
Type | Description |
---|---|
Boolean | return the state of the sub foldout header |
DrawVector6(GUIContent, SerializedProperty, SerializedProperty, Vector3, Vector3, Color[], SerializedProperty, Boolean)
Draw a Vector6 field
Declaration
public static void DrawVector6(GUIContent label, SerializedProperty positive, SerializedProperty negative, Vector3 min, Vector3 max, Color[] colors = null, SerializedProperty multiplicator = null, bool allowIntersection = true)
Parameters
Type | Name | Description |
---|---|---|
GUIContent | label | The label |
SerializedProperty | positive | The data for +X, +Y and +Z |
SerializedProperty | negative | The data for -X, -Y and -Z |
Vector3 | min | Min clamping value along axis |
Vector3 | max | Max clamping value along axis |
Color[] | colors | [Optional] Color marks to use |
SerializedProperty | multiplicator | [Optional] multiplicator on the datas |
Boolean | allowIntersection | [Optional] Allow the face positive values to be smaller than negative ones and vice versa |
FindProperty<T, TValue>(Expression<Func<T, TValue>>)
To use with extreme caution. It not really get the property but try to find a field with similar name Hence inheritance override of property is not supported. Also variable rename will silently break the search.
Declaration
public static string FindProperty<T, TValue>(Expression<Func<T, TValue>> expr)
Parameters
Type | Name | Description |
---|---|---|
Expression<Func<T, TValue>> | expr | Expression returning the value seeked |
Returns
Type | Description |
---|---|
String | serialization path of the seeked property |
Type Parameters
Name | Description |
---|---|
T | Entry type of expr |
TValue | Type of the value |
GetAdditionalData<T>(Object[], Action<T>)
Get the AdditionalData of the given component
Declaration
public static T[] GetAdditionalData<T>(Object[] targets, Action<T> initDefault = null)
where T : Component
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.Object[] | targets | The object to seek for AdditionalData |
Action<T> | initDefault | [Optional] The default value to use if there is no AdditionalData |
Returns
Type | Description |
---|---|
T[] | return an AdditionalData component |
Type Parameters
Name | Description |
---|---|
T | The type of the AdditionalData component |
GetCurrentProjectVersion()
Parse and return current project version
Declaration
public static string GetCurrentProjectVersion()
Returns
Type | Description |
---|---|
String | The version |
LoadIcon(String, String, String)
Load an icon regarding skin and editor resolution. Icon should be stored as legacy icon resources:
- "d_" prefix for Professional theme
- "@2x" suffix for high resolution
Declaration
public static Texture2D LoadIcon(string path, string name, string extention = ".png")
Parameters
Type | Name | Description |
---|---|---|
String | path | Path to seek the icon from Assets/ folder |
String | name | Icon name without suffix, prefix or extention |
String | extention | [Optional] Extention of file (png per default) |
Returns
Type | Description |
---|---|
Texture2D | The loaded texture |
RemoveMaterialKeywords(Material)
Remove the keywords on the given materials
Declaration
public static void RemoveMaterialKeywords(Material material)
Parameters
Type | Name | Description |
---|---|---|
Material | material | The material to edit |