-
Notifications
You must be signed in to change notification settings - Fork 23
SolidUtilities.Editor
Namespace: GenericScriptableObjects.Usage_Example.Editor
Base class: PropertyDrawer
Name | Type | Summary |
---|---|---|
attribute | PropertyAttribute | |
fieldInfo | FieldInfo |
Name | Returns | Summary |
---|---|---|
GetPropertyHeight(SerializedProperty property, GUIContent label) | float | |
OnGUI(Rect position, SerializedProperty property, GUIContent label) | void |
float
Namespace: SolidUtilities.Editor.Extensions
Different useful extensions for UnityEditor.EditorWindow.
Name | Returns | Summary |
---|---|---|
CenterOnMainWin(EditorWindow window) | void | Centers the window in the main Unity window. This is not the same as centering a window on screen, because the Unity window may not be maximized. |
MoveOutOfScreen(EditorWindow window) | void | Moves the window out of screen to hide but not close it. |
Resize(EditorWindow window, float width, float height) | void | Resizes the window to the needed size. |
Centers the window in the main Unity window. This is not the same as centering a window on screen, because the Unity window may not be maximized.
Parameter | Type | Description |
---|---|---|
window | EditorWindow | The window to center. |
Moves the window out of screen to hide but not close it.
Parameter | Type | Description |
---|---|---|
window | EditorWindow | The window to hide. |
Resizes the window to the needed size.
Parameter | Type | Description |
---|---|---|
window | EditorWindow | The window to change the size of. |
width | float | The width to set. If the value is -1f, the width will not be changed. |
height | float | The height to set. If the value is -1f, the height will not be changed. |
public class DummyWindow : EditorWindow
{
private void OnCreate(Rect buttonRect)
{
var windowSize = new Vector2(100f, 100f);
ShowAsDropDown(buttonRect, windowSize);
}
private void OnGUI()
{
float optimalWidth = CalculateOptimalWidth();
float optimalHeight = Math.Min(_contentHeight, DropdownStyle.MaxWindowHeight);
this.Resize(optimalWidth, optimalHeight);
}
}
Namespace: SolidUtilities.Editor.Extensions
Name | Returns | Summary |
---|---|---|
GetAssemblyName(MonoScript script) | string | Returns the assembly name of the class implemented by this script. |
GetClassType(MonoScript script) | Type | Returns the System.Type of the class implemented by this script. Works for types not derived from UnityEngine.Object and generic classes (the file must be named by the "GenericClass`1.cs" template). |
Returns the assembly name of the class implemented by this script.
Parameter | Type | Description |
---|---|---|
script | MonoScript | The script to search for assembly in. |
string
The assembly name without the .dll extension, or an empty string if the assembly was not found.
Returns the System.Type of the class implemented by this script. Works for types not derived from UnityEngine.Object and generic classes (the file must be named by the "GenericClass`1.cs" template).
Parameter | Type | Description |
---|---|---|
script | MonoScript | The script to get the type from. |
The System.Type of the class implemented by this script or null
,
Namespace: SolidUtilities.Editor.Extensions
Provides methods that allow to copy values from one UnityEngine.Object to another. It works with UnityEditor.SerializedObject too.
Name | Returns | Summary |
---|---|---|
[CopyValuesFrom(SerializedObject thisSerializedObject, Object otherObject, HashSet<string> excludeValues)](#copyvaluesfromserializedobject-thisserializedobject-object-otherobject-hashsethttpsdocsmicrosoftcomen-usdotnetapisystemcollectionsgenerichashset-1string-excludevalues) | void | Copies values of the visible properties from otherObject to thisSerializedObject. |
[CopyValuesFrom(Object thisObject, Object otherObject, HashSet<string> excludeValues)](#copyvaluesfromobject-thisobject-object-otherobject-hashsethttpsdocsmicrosoftcomen-usdotnetapisystemcollectionsgenerichashset-1string-excludevalues) | void | Copies values of the visible properties from otherObject to thisObject. |
[CopyValuesFrom(Object thisObject, SerializedObject otherObject, HashSet<string> excludeValues)](#copyvaluesfromobject-thisobject-serializedobject-otherobject-hashsethttpsdocsmicrosoftcomen-usdotnetapisystemcollectionsgenerichashset-1string-excludevalues) | void | Copies values of the visible properties from otherObject to thisObject. |
[CopyValuesFrom(SerializedObject thisObject, SerializedObject otherObject, HashSet<string> excludeValues)](#copyvaluesfromserializedobject-thisobject-serializedobject-otherobject-hashsethttpsdocsmicrosoftcomen-usdotnetapisystemcollectionsgenerichashset-1string-excludevalues) | void | Copies values of the visible properties from otherObject to thisObject. |
CopyValuesFrom(SerializedObject thisSerializedObject, Object otherObject, HashSet<string> excludeValues)
Copies values of the visible properties from otherObject to thisSerializedObject.
Parameter | Type | Description |
---|---|---|
thisSerializedObject | SerializedObject | Destination object. |
otherObject | Object | Source object. |
excludeValues | HashSet<string> | Names of properties to exclude from copying. |
CopyValuesFrom(Object thisObject, Object otherObject, HashSet<string> excludeValues)
Copies values of the visible properties from otherObject to thisObject.
Parameter | Type | Description |
---|---|---|
thisObject | Object | Destination object. |
otherObject | Object | Source object. |
excludeValues | HashSet<string> | Names of properties to exclude from copying. |
CopyValuesFrom(Object thisObject, SerializedObject otherObject, HashSet<string> excludeValues)
Copies values of the visible properties from otherObject to thisObject.
Parameter | Type | Description |
---|---|---|
thisObject | Object | Destination object. |
otherObject | SerializedObject | Source object. |
excludeValues | HashSet<string> | Names of properties to exclude from copying. |
CopyValuesFrom(SerializedObject thisObject, SerializedObject otherObject, HashSet<string> excludeValues)
Copies values of the visible properties from otherObject to thisObject.
Parameter | Type | Description |
---|---|---|
thisObject | SerializedObject | Destination object. |
otherObject | SerializedObject | Source object. |
excludeValues | HashSet<string> | Names of properties to exclude from copying. |
Namespace: SolidUtilities.Editor.Extensions
Different useful extensions for UnityEditor.SerializedProperty.
Name | Returns | Summary |
---|---|---|
GetObjectType(SerializedProperty property) | Type | Gets type of the object serialized by the property. |
IsBuiltIn(SerializedProperty property) | bool | Checks whether the serialized property is built-in. UnityEditor.SerializedObject has a lot of built-in properties and we are often interested only in the custom ones. |
Gets type of the object serialized by the property.
Parameter | Type | Description |
---|---|---|
property | SerializedProperty | The property whose type to find. |
Type of the object serialized by property.
Checks whether the serialized property is built-in. UnityEditor.SerializedObject has a lot of built-in properties and we are often interested only in the custom ones.
Parameter | Type | Description |
---|---|---|
property | SerializedProperty | The property to check. |
bool
Whether the property is built-in.
Namespace: SolidUtilities.Editor.Helpers
Name | Returns | Summary |
---|---|---|
GetTypeFromGUID(string guid) | Type | Retrieves type of the class located in an asset with the matching guid. |
Retrieves type of the class located in an asset with the matching guid.
Parameter | Type | Description |
---|---|---|
guid | string | The GUID of an asset to search for. |
Type of the class located in an asset with the matching guid.
Namespace: SolidUtilities.Editor.Helpers
A class that allows to find assets provided different parameters.
Name | Returns | Summary |
---|---|---|
FindObjectsWithValue(string variableName, string value) | List<FoundObject> | Finds all scriptable objects, scene objects, prefabs, and their overrides that contain a variable named variableName with value equal to value. |
[GetAssetDetails(Type type, out string GUID, out MonoScript monoScript)](#getassetdetailstypehttpsdocsmicrosoftcomen-usdotnetapisystemtype-type-out-string-guid-out-monoscript-monoscript) | bool | Gets the GUID of an asset where the type is located. |
[GetClassGUID(Type type)](#getclassguidtypehttpsdocsmicrosoftcomen-usdotnetapisystemtype-type) | string | |
[GetMonoScriptFromType(Type type)](#getmonoscriptfromtypetypehttpsdocsmicrosoftcomen-usdotnetapisystemtype-type) | MonoScript |
Finds all scriptable objects, scene objects, prefabs, and their overrides that contain a variable named variableName with value equal to value.
Parameter | Type | Description |
---|---|---|
variableName | string | The name of the variable to search for. |
value | string | The value of the variable to search for. |
A list of SolidUtilities.Editor.Helpers.FoundObject that contain details about each found match.
[Serializable] public class CustomClass
{
[SerializeField] private string _testField;
}
public class TestBehaviour : MonoBehaviour
{
[SerializeField] private CustomClass _test;
}
public class TestScriptableObject : ScriptableObject
{
public CustomClass ScriptableTestField;
}
// This will find all prefabs, scriptable objects, and scene objects where the value of _testField was set
// to "value set in editor". It will then output details about each found match: path to the asset, component
// where the variable was found, etc.
var foundObjects = AssetSearcher.FindObjectsWithValue("_testField", "value set in editor");
foreach (FoundObject foundObject in foundObjects)
{
Debug.Log($"[foundObject.Type]");
foreach (var detail in foundObject)
{
Debug.Log($"{detail.Key}: {detail.Value}");
}
}
GetAssetDetails(Type type, out string GUID, out MonoScript monoScript)
Gets the GUID of an asset where the type is located.
Parameter | Type | Description |
---|---|---|
type | Type | Type to search for in assets. |
GUID | out string | GUID of the asset where the type is located, or null if the asset was not found. |
monoScript | out MonoScript | MonoScript of the asset where the type is located, or null if the asset was not found. |
bool
true
if the asset with the specified type was found.
GetClassGUID(Type type)
string
GetMonoScriptFromType(Type type)
MonoScript
Namespace: SolidUtilities.Editor.Helpers
Allows iterating over child properties of a serialized object without entering nested properties.
var childProperties = new ChildProperties(serializedObject);
foreach (var child in childProperties)
{
FieldInfo field = targetType.GetFieldAtPath(child.propertyPath);
Draw(field);
}
Name | Type | Summary |
---|---|---|
System.Collections.Generic.IEnumerator<UnityEditor.SerializedProperty>.Current | SerializedProperty | |
System.Collections.IEnumerator.Current | Object |
Name | Summary |
---|---|
ChildProperties(SerializedObject parentObject, bool enterChildren, bool excludeBuiltInProperties, bool visibleOnly) | Initializes a new instance of the SolidUtilities.Editor.Helpers.ChildProperties class. |
Name | Returns | Summary |
---|---|---|
Reset() | void |
ChildProperties(SerializedObject parentObject, bool enterChildren, bool excludeBuiltInProperties, bool visibleOnly)
Initializes a new instance of the SolidUtilities.Editor.Helpers.ChildProperties class.
Parameter | Type | Description |
---|---|---|
parentObject | SerializedObject | The parent serialized object which child properties you want to inspect. |
enterChildren | bool | Whether to iterate through child properties recursively. false by default. |
excludeBuiltInProperties | bool | Whether to exclude built-in properties from the iteration. true by default. |
visibleOnly | bool | Whether to iterate only over the visible properties. |
Namespace: SolidUtilities.Editor.Helpers
Allows to create a UnityEngine.GUIContent instance and keep it in cache, reducing the garbage collection overhead.
Name | Returns | Summary |
---|---|---|
GetItem(string text) | GUIContent | Get cached GUIContent or create a new one and cache it. |
Get cached GUIContent or create a new one and cache it.
Parameter | Type | Description |
---|---|---|
text | string | Text in GUIContent. |
GUIContent
GUIContent instance containing the text.
GUI.Label(placeHolderArea, ContentCache.GetItem(placeholder), PlaceholderStyle);
Namespace: SolidUtilities.Editor.Helpers
Different useful methods that simplify UnityEditor.EditorGUILayout API.
Name | Type | Summary |
---|---|---|
InfoMessageStyle | GUIStyle | |
PlaceholderStyle | GUIStyle |
Name | Returns | Summary |
---|---|---|
[CheckIfChanged(Action drawContent)](#checkifchangedactionhttpsdocsmicrosoftcomen-usdotnetapisystemaction-drawcontent) | bool | Draws content and checks if it was changed. |
CreateEditor(Object targetObject) | T | Creates an editor of type T for targetObject. |
DelayedPropertyField(SerializedProperty property, GUIContent label, GUILayoutOption[] options) | bool | Draws the property identically to UnityEditor.EditorGUILayout.PropertyField(UnityEditor.SerializedProperty,UnityEngine.GUIContent,UnityEngine.GUILayoutOption[]) but makes fields delayed where possible. |
DrawBorders(float rectWidth, float rectHeight, Color color, float borderWidth) | void | Draws borders with a given color and width around a rectangle. |
DrawInfoMessage(string message) | void | Shows the info message. |
FocusedTextField(Rect rect, string text, string placeholder, GUIStyle style, string controlName) | string | Draws a text field that is always focused. |
GetMainWindowPosition() | Rect | Returns the rectangle of the main Unity window. |
GetScreenWidth() | float | Returns the same value as Screen.currentResolution.width if one screen is used. Returns the sum of two screens' widths when two monitors are used and Unity is located on the second screen. It will only return the incorrect value when Unity is located on the second screen and is not fullscreen. |
Name | Type | Summary |
---|---|---|
ContentCache | ContentCache | Cache that creates UnityEngine.GUIContent instances and keeps them, reducing the garbage collection overhead. |
CheckIfChanged(Action drawContent)
Draws content and checks if it was changed.
Parameter | Type | Description |
---|---|---|
drawContent | Action | Action that draws the content. |
bool
Whether the content was changed.
bool changed = EditorDrawHelper.CheckIfChanged(() =>
{
_searchString = DrawSearchField(innerToolbarArea, _searchString);
});
Creates an editor of type T for targetObject.
Parameter | Type | Description |
---|---|---|
targetObject | Object | Target object to create an editor for. |
T
Editor of type T.
Draws the property identically to UnityEditor.EditorGUILayout.PropertyField(UnityEditor.SerializedProperty,UnityEngine.GUIContent,UnityEngine.GUILayoutOption[]) but makes fields delayed where possible.
Parameter | Type | Description |
---|---|---|
property | SerializedProperty | The SerializedProperty to make a field for. |
label | GUIContent | Optional label to use. If not specified the label of the property itself is used. Use GUIContent.none to not display a label at all. |
options | GUILayoutOption[] | An optional list of layout options that specify extra layout properties. Any values passed in here will override settings defined by the style. See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, |
bool
True if the property has children and is expanded and includeChildren was set to false; otherwise false.
Draws borders with a given color and width around a rectangle.
Parameter | Type | Description |
---|---|---|
rectWidth | float | Width of the rectangle. |
rectHeight | float | Height of the rectangle. |
color | Color | Color of the borders. |
borderWidth | float | Width of the borders. |
EditorDrawHelper.DrawBorders(position.width, position.height, DropdownStyle.BorderColor);
Shows the info message.
Parameter | Type | Description |
---|---|---|
message | string | The message to output. |
EditorDrawHelper.DrawInfoMessage("No types to select.");
Draws a text field that is always focused.
Parameter | Type | Description |
---|---|---|
rect | Rect | Rectangle to draw the field in. |
text | string | The text to show in the field. |
placeholder | string | Placeholder to show if the field is empty. |
style | GUIStyle | Style to draw the field with. |
controlName | string | Unique control name of the field. |
string
The text that was written to the field.
searchText = EditorDrawHelper.FocusedTextField(searchFieldArea, searchText, "Search",
DropdownStyle.SearchToolbarStyle, _searchFieldControlName);
Returns the rectangle of the main Unity window.
Rect
Rectangle of the main Unity window.
Returns the same value as Screen.currentResolution.width if one screen is used. Returns the sum of two screens' widths when two monitors are used and Unity is located on the second screen. It will only return the incorrect value when Unity is located on the second screen and is not fullscreen.
float
Screen width if one monitor is used, or sum of screen widths if multiple monitors are used.
Namespace: SolidUtilities.Editor.Helpers
Collection of icons to use for creating custom inspectors and drawers. Icons can have different tints depending on their state: active, highlighted, etc.
var messageContent = new GUIContent(message, EditorIcons.Info);
EditorIcon triangleIcon = Expanded ? EditorIcons.TriangleDown : EditorIcons.TriangleRight;
Name | Type | Summary |
---|---|---|
Info | Texture2D | The default Unity info icon. |
TriangleRight | EditorIcon | Triangle with one of the vertices looking to the right. Useful in foldout menus. |
TriangleDown | EditorIcon | Triangle with one of the vertices looking to the bottom. Useful in foldout menus. |
Namespace: SolidUtilities.Editor.Helpers
Represents information about object found with the matching value of a variable. It contains the object type (scene object, prefab, etc.) and details about where the variable with the matching value was found (path to the asset, the component where it was found, etc.)
Name | Summary |
---|---|
[FoundObject(ObjectType objectType)](#foundobjectobjecttypeobjecttype-enum-objecttype) |
Name | Returns | Summary |
---|---|---|
Add(string key, string value) | void | |
GetEnumerator() | Enumerator |
Name | Type | Summary |
---|---|---|
Type | ObjectType |
FoundObject(ObjectType objectType)
Enumerator
Namespace: SolidUtilities.Editor.Helpers
Name | Summary |
---|---|
IndentLevel(int indentLevel) |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Namespace: SolidUtilities.Editor.Helpers
Contains different methods that simplify or extend operations on log entries.
Name | Returns | Summary |
---|---|---|
Clear() | void | Removes all logs from the console. |
GetCount() | int | Returns the total number of log entries in the console. |
GetCountByType() | (int errorCount, int warningCount, int logCount) | Returns the number of log entries in the console by type: error logs, warning logs, info logs. |
GetErrorCount() | int | Returns the number of errors in the console. |
GetLogCount() | int | Returns the number of info logs in the console. |
GetWarningCount() | int | Returns the number of warnings in the console. |
[RemoveLogEntriesByMode(LogModes mode)](#removelogentriesbymodelogmodeslogmodes-enum-mode) | void | Removes log entries that match mode from console. |
Removes all logs from the console.
Returns the total number of log entries in the console.
int
Total number of log entries in the console.
Returns the number of log entries in the console by type: error logs, warning logs, info logs.
(int errorCount, int warningCount, int logCount)
The number of log entries in the console by type: error logs, warning logs, info logs.
Returns the number of errors in the console.
int
The number of errors in the console.
Returns the number of info logs in the console.
int
The number of info logs in the console.
Returns the number of warnings in the console.
int
The number of warnings in the console.
RemoveLogEntriesByMode(LogModes mode)
Removes log entries that match mode from console.
Parameter | Type | Description |
---|---|---|
mode | LogModes | Mode of the log entries to remove. |
Namespace: SolidUtilities.Editor.Helpers
Name | Summary |
---|---|
UserAll | All user-generated log entries. |
EditorErrors | Editor-generated errors. |
UserErrorsAndExceptions | User-generated red log entries (errors, exceptions, assertions). |
UserAndEditorWarnings | User and editor-generated warnings. |
UserAndEditorInfos | User and editor-generated info messages. |
NoScriptAssetWarning | Mode of the "No script asset for..." warning. |
UserWarning | User-generated warnings. |
UserInfo | User-generated info messages. |
Namespace: SolidUtilities.Editor.Helpers
Sets UnityEditor.EditorGUI.showMixedValue to the needed value temporarily.
using (new EditorDrawHelper.MixedValue(true))
{
DrawTypeSelectionControl();
}
Name | Summary |
---|---|
MixedValue(bool showMixedValue) | Sets UnityEditor.EditorGUI.showMixedValue to the needed value temporarily. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Sets UnityEditor.EditorGUI.showMixedValue to the needed value temporarily.
Parameter | Type | Description |
---|---|---|
showMixedValue | bool | Whether to show mixed value. |
using (new EditorDrawHelper.MixedValue(true))
{
DrawTypeSelectionControl();
}
Namespace: SolidUtilities.Editor.Helpers
Name | Summary |
---|---|
ScriptableObject | |
Prefab | |
SceneObject | |
PrefabOverride |
Namespace: SolidUtilities.Editor.Helpers
Name | Returns | Summary |
---|---|---|
FindPackageByName(string packageName) | PackageInfo | Finds a package by its UnityEditor.PackageManager.PackageInfo.name or UnityEditor.PackageManager.PackageInfo.displayName. |
Finds a package by its UnityEditor.PackageManager.PackageInfo.name or UnityEditor.PackageManager.PackageInfo.displayName.
Parameter | Type | Description |
---|---|---|
packageName | string | UnityEditor.PackageManager.PackageInfo.name or UnityEditor.PackageManager.PackageInfo.displayName of the package to search for. |
PackageInfo
Package Info object of the package or null
if the package was not found.
Namespace: SolidUtilities.Editor.Helpers
Name | Returns | Summary |
---|---|---|
Next(SerializedProperty prop, bool enterChildren, bool visible) | bool |
bool
Namespace: SolidUtilities.Editor.Helpers
Draws content in a property wrapper, useful for making regular GUI controls work with SerializedProperty.
Name | Summary |
---|---|
PropertyWrapper(Rect position, GUIContent label, SerializedProperty property) | Draws content in a property wrapper, useful for making regular GUI controls work with SerializedProperty. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Draws content in a property wrapper, useful for making regular GUI controls work with SerializedProperty.
Parameter | Type | Description |
---|---|---|
position | Rect | Rectangle on the screen to use for the control, including label if applicable. |
label | GUIContent | Optional label in front of the slider. Use null to use the name from the |
property | SerializedProperty | The SerializedProperty to use for the control. |
Namespace: SolidUtilities.Editor.Helpers
Draws content in an automatically laid out scroll view.
_thumbPos = EditorDrawHelper.DrawInScrollView(_thumbPos, () =>
{
float contentHeight = EditorDrawHelper.DrawVertically(_selectionTree.Draw, _preventExpandingHeight,
DropdownStyle.BackgroundColor);
});
Name | Summary |
---|---|
ScrollView(ref Vector2 scrollPos) | Draws content in an automatically laid out scroll view. |
ScrollView(ref Vector2 scrollPos, bool visible) | Draws content in an automatically laid out scroll view. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Draws content in an automatically laid out scroll view.
Parameter | Type | Description |
---|---|---|
scrollPos | ref Vector2 | Position of the thumb that is changed to the new thumb position upon SolidUtilities.Editor.Helpers.EditorDrawHelper.ScrollView initialization. |
Draws content in an automatically laid out scroll view.
Parameter | Type | Description |
---|---|---|
scrollPos | ref Vector2 | Position of the thumb that is changed to the new thumb position upon SolidUtilities.Editor.Helpers.EditorDrawHelper.ScrollView initialization. |
visible | bool | Whether scrollbar should be visible (it may not be visible if the list is short enough to fit the window.) |
Namespace: SolidUtilities.Editor.Helpers
Applies the search toolbar style to the stuff that will be drawn inside.
using (new EditorDrawHelper.SearchToolbarStyle(DropdownStyle.SearchToolbarHeight))
{
DrawSearchToolbar();
}
Name | Type | Summary |
---|---|---|
Style | GUIStyle |
Name | Summary |
---|---|
SearchToolbarStyle(float toolbarHeight) | Applies the search toolbar style to the stuff that will be drawn inside. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Applies the search toolbar style to the stuff that will be drawn inside.
Parameter | Type | Description |
---|---|---|
toolbarHeight | float | Height of the toolbar. |
using (new EditorDrawHelper.SearchToolbarStyle(DropdownStyle.SearchToolbarHeight))
{
DrawSearchToolbar();
}
Namespace: SolidUtilities.Editor.Helpers
Temporarily sets UnityEngine.GL.sRGBWrite to the passed value, then returns it back.
Name | Summary |
---|---|
SRGBWriteScope(bool enableWrite) | Temporarily sets UnityEngine.GL.sRGBWrite to ****, then executes the action. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Temporarily sets UnityEngine.GL.sRGBWrite to ****, then executes the action.
Parameter | Type | Description |
---|---|---|
enableWrite | bool | Temporary value of UnityEngine.GL.sRGBWrite. |
using (new SRGBWriteScope(true))
{
GL.Clear(false, true, new Color(1f, 1f, 1f, 0f));
Graphics.Blit(Default, temporary, material);
});
Namespace: SolidUtilities.Editor.Helpers
Creates a temporary texture, sets it as active in UnityEngine.RenderTexture.active, then removes the changes and sets the previous active texture back automatically.
using (var temporaryActiveTexture = new TemporaryActiveTexture(icon.width, icon.height, 0))
{
Graphics.Blit(icon, temporary, material);
});
Name | Summary |
---|---|
TemporaryActiveTexture(int width, int height, int depthBuffer) | Creates a temporary texture, sets it as active in UnityEngine.RenderTexture.active, then removes it and sets the previous active texture back automatically. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Creates a temporary texture, sets it as active in UnityEngine.RenderTexture.active, then removes it and sets the previous active texture back automatically.
Parameter | Type | Description |
---|---|---|
width | int | Width of the temporary texture in pixels. |
height | int | Height of the temporary texture in pixels. |
depthBuffer | int | Depth buffer of the temporary texture. |
using (var temporaryActiveTexture = new TemporaryActiveTexture(icon.width, icon.height, 0))
{
Graphics.Blit(icon, temporary, material);
});
Namespace: SolidUtilities.Editor.Helpers
Creates a temporary texture that can be used and then removed automatically.
using (var temporaryTexture = new TemporaryRenderTexture(icon.width, icon.height, 0))
{
Graphics.Blit(icon, temporaryTexture, material);
});
Name | Summary |
---|---|
TemporaryRenderTexture(int width, int height, int depthBuffer) | Creates a temporary texture that can be used and then removed automatically. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Creates a temporary texture that can be used and then removed automatically.
Parameter | Type | Description |
---|---|---|
width | int | Width of the temporary texture in pixels. |
height | int | Height of the temporary texture in pixels. |
depthBuffer | int | Depth buffer of the temporary texture. |
using (var temporaryTexture = new TemporaryRenderTexture(icon.width, icon.height, 0))
{
Graphics.Blit(icon, temporaryTexture, material);
});
Namespace: SolidUtilities.Editor.Helpers
Helps to create new textures.
Namespace: SolidUtilities.Editor.Helpers
Draws content in the vertical direction.
using (new EditorDrawHelper.VerticalBlock(_preventExpandingHeight, DropdownStyle.BackgroundColor, out float contentHeight))
{
_selectionTree.Draw();
if (Event.current.type == EventType.Repaint)
_contentHeight = contentHeight;
}
Name | Summary |
---|---|
VerticalBlock(out Rect rect) | Draws content in the vertical direction. |
VerticalBlock(GUILayoutOption option, Color backgroundColor, out float height) | Draws content in the vertical direction. |
Name | Returns | Summary |
---|---|---|
Dispose() | void |
Draws content in the vertical direction.
Parameter | Type | Description |
---|---|---|
rect | out Rect | Rectangle of the vertical group. |
Rect newWholeListRect = EditorDrawHelper.DrawVertically(() =>
{
for (int index = 0; index < nodes.Count; ++index)
nodes[index].DrawSelfAndChildren(0, visibleRect);
});
Draws content in the vertical direction.
Parameter | Type | Description |
---|---|---|
option | GUILayoutOption | Option to draw the vertical group with. |
backgroundColor | Color | Background of the vertical group rectangle. |
height | out float | Height of the vertical group rectangle. |
using (new EditorDrawHelper.VerticalBlock(_preventExpandingHeight, DropdownStyle.BackgroundColor, out float contentHeight))
{
_selectionTree.Draw();
if (Event.current.type == EventType.Repaint)
_contentHeight = contentHeight;
}
Namespace: SolidUtilities.Editor.Helpers.EditorIconsRelated
Icon that can have different tints depending on its state: active, highlighted, etc. Useful for creating custom inspectors and drawers.
Name | Summary |
---|---|
EditorIcon(Texture2D icon) |
Name | Type | Summary |
---|---|---|
Default | Texture2D | Icon with the default color. |
Active | Texture2D | Icon with the active state tint. |
Highlighted | Texture2D | Icon with the highlighted state tint. |
Namespace: SolidUtilities.Editor.Helpers.EditorIconsRelated
Base class: ScriptableObject
Scriptable object that holds references to resources needed for SolidUtilities.Editor.Helpers.EditorIcons. With this database, we only need to know a GUID of the scriptable object instead of GUIDS or paths to all the resources used in SolidUtilities.Editor.Helpers.EditorIcons.
Name | Type | Summary |
---|---|---|
Active | Material | |
Highlighted | Material | |
name | string | |
hideFlags | HideFlags |
Name | Type | Summary |
---|---|---|
TriangleRight | Texture2D |
Namespace: SolidUtilities.Editor.PropertyDrawers
Name | Summary |
---|---|
None | |
Add | |
Remove |
Namespace: SolidUtilities.Editor.PropertyDrawers
Name | Type | Summary |
---|---|---|
ConflictKey | Object | |
ConflictValue | Object | |
ConflictIndex | int | |
ConflictOtherIndex | int | |
ConflictKeyPropertyExpanded | bool | |
ConflictValuePropertyExpanded | bool | |
ConflictLineHeight | float |
Namespace: SolidUtilities.Editor.PropertyDrawers
Name | Summary |
---|---|
EnumerationEntry(SerializedProperty keyProperty, SerializedProperty valueProperty, int index) |
Name | Type | Summary |
---|---|---|
KeyProperty | SerializedProperty | |
ValueProperty | SerializedProperty | |
Index | int |
Namespace: SolidUtilities.Editor.PropertyDrawers
Name | Summary |
---|---|
PropertyIdentity(SerializedProperty property) |
Name | Returns | Summary |
---|---|---|
[Equals(Object obj)](#equalsobjecthttpsdocsmicrosoftcomen-usdotnetapisystemobject-obj) | bool | |
[Equals(PropertyIdentity p)](#equalspropertyidentitypropertyidentity-struct-p) | bool | |
GetHashCode() | int |
Equals(Object obj)
bool
Equals(PropertyIdentity p)
bool
int
Namespace: SolidUtilities.Editor.PropertyDrawers
Base class: PropertyDrawer
Name | Type | Summary |
---|---|---|
Style | GUIStyle | |
attribute | PropertyAttribute | |
fieldInfo | FieldInfo |
Name | Returns | Summary |
---|---|---|
GetPropertyHeight(SerializedProperty property, GUIContent label) | float | |
OnGUI(Rect fieldRect, SerializedProperty property, GUIContent label) | void |
float
Namespace: SolidUtilities.Editor.PropertyDrawers
Base class: PropertyDrawer
Property drawer for SolidUtilities.SerializableCollections.SerializableDictionary`2.
Name | Type | Summary |
---|---|---|
attribute | PropertyAttribute | |
fieldInfo | FieldInfo |
Name | Returns | Summary |
---|---|---|
GetPropertyHeight(SerializedProperty property, GUIContent label) | float | |
OnGUI(Rect position, SerializedProperty property, GUIContent label) | void |
float