Skip to main content

Class ServiceFrameworkInspectorUtility

Namespace: RealityCollective.ServiceFramework.Editor.Utilities

This class has handy inspector utilities and functions.

public static class ServiceFrameworkInspectorUtility

Inheritance

object ← ServiceFrameworkInspectorUtility

Fields

DarkColor

public static readonly Color DarkColor

Field Value

Color

DisabledColor

public static readonly Color DisabledColor

Field Value

Color

DottedLineScreenSpace

public const float DottedLineScreenSpace = 4.65

Field Value

float

ErrorColor

public static readonly Color ErrorColor

Field Value

Color

HandleColorAxis

public static readonly Color HandleColorAxis

Field Value

Color

HandleColorCircle

public static readonly Color HandleColorCircle

Field Value

Color

HandleColorRotation

public static readonly Color HandleColorRotation

Field Value

Color

HandleColorSphere

public static readonly Color HandleColorSphere

Field Value

Color

HandleColorSquare

public static readonly Color HandleColorSquare

Field Value

Color

HandleColorTangent

public static readonly Color HandleColorTangent

Field Value

Color

LineVelocityColor

public static readonly Color LineVelocityColor

Field Value

Color

SectionColor

public static readonly Color SectionColor

Field Value

Color

SuccessColor

public static readonly Color SuccessColor

Field Value

Color

WarningColor

public static readonly Color WarningColor

Field Value

Color

Properties

BoldCenteredHeaderStyle

public static GUIStyle BoldCenteredHeaderStyle { get; }

Property Value

GUIStyle

public static Texture2D DarkThemeLogo { get; }

Property Value

Texture2D

HorizontalLineStyle

public static GUIStyle HorizontalLineStyle { get; }

Property Value

GUIStyle

public static Texture2D LightThemeLogo { get; }

Property Value

Texture2D

Methods

AxisMoveHandle(Object, Vector3, Vector3, float, float, bool, bool)

Draw an axis move handle.

public static float AxisMoveHandle(UnityEngine.Object target, Vector3 origin, Vector3 direction, float distance, float handleSize = 0.2, bool autoSize = true, bool recordUndo = true)

Parameters

target UnityEngine.Object

UnityEngine.Object that is undergoing the transformation. Also used for recording undo.

origin Vector3

The initial position of the axis.

direction Vector3

The direction the axis is facing.

distance float

Distance from the axis.

handleSize float

Optional handle size.

autoSize bool

Optional, auto sizes the handles based on position and handle size.

recordUndo bool

Optional, records undo state.

Returns

float

The new Single value.

CenterOnMainWin(EditorWindow)

Centers an editor window on the main display.

public static void CenterOnMainWin(this EditorWindow window)

Parameters

window EditorWindow

CircleMoveHandle(Object, Vector3, float, float, float, float, bool, bool)

Draw a Circle Move Handle.

public static Vector3 CircleMoveHandle(UnityEngine.Object target, Vector3 position, float xScale = 1, float yScale = 1, float zScale = 1, float handleSize = 0.2, bool autoSize = true, bool recordUndo = true)

Parameters

target UnityEngine.Object

UnityEngine.Object that is undergoing the transformation. Also used for recording undo.

position Vector3

The position to draw the handle.

xScale float

Scale the new value on the x axis by this amount.

yScale float

Scale the new value on the x axis by this amount.

zScale float

Scale the new value on the x axis by this amount.

handleSize float

Optional handle size.

autoSize bool

Optional, auto sizes the handles based on position and handle size.

recordUndo bool

Optional, records undo state.

Returns

Vector3

The new Vector3 value.

DrawWireCapsule(Vector3, Quaternion, float, float, Color)

Renders a capsule wire gizmo.

public static void DrawWireCapsule(Vector3 position, Quaternion rotation, float radius, float height, Color color = null)

Parameters

position Vector3

Center position of the capsule.

rotation Quaternion

Center rotation of the capsule.

radius float

Capsule radius.

height float

Capsule height.

color Color

Optional color override, will use Gizmos.color by default.

GetEditorMainWindowPos()

Found at https://answers.unity.com/questions/960413/editor-window-how-to-center-a-window.html

public static Rect GetEditorMainWindowPos()

Returns

Rect

HorizontalLine(Color)

public static void HorizontalLine(Color color)

Parameters

color Color

RenderInspectorHeader(Texture2D)

Render a header for the profile inspector.

public static void RenderInspectorHeader(Texture2D image)

Parameters

image Texture2D

Render the Mixed Reality Toolkit Logo.

public static void RenderLogo()

RotationHandle(Object, Vector3, Quaternion, float, bool, bool)

Draw a rotation handle.

public static Quaternion RotationHandle(UnityEngine.Object target, Vector3 position, Quaternion rotation, float handleSize = 0.2, bool autoSize = true, bool recordUndo = true)

Parameters

target UnityEngine.Object

UnityEngine.Object that is undergoing the transformation. Also used for recording undo.

position Vector3

The position to draw the handle.

rotation Quaternion

The rotation to draw the handle.

handleSize float

Optional, handle size.

autoSize bool

Optional, auto sizes the handles based on position and handle size.

recordUndo bool

Optional, records undo state.

Returns

Quaternion

The new Quaternion value.

SphereMoveHandle(Object, Vector3, float, float, float, float, bool, bool)

Draw a sphere move handle.

public static Vector3 SphereMoveHandle(UnityEngine.Object target, Vector3 position, float xScale = 1, float yScale = 1, float zScale = 1, float handleSize = 0.2, bool autoSize = true, bool recordUndo = true)

Parameters

target UnityEngine.Object

UnityEngine.Object that is undergoing the transformation. Also used for recording undo.

position Vector3

The position to draw the handle.

xScale float

Scale the new value on the x axis by this amount.

yScale float

Scale the new value on the x axis by this amount.

zScale float

Scale the new value on the x axis by this amount.

handleSize float

Optional handle size.

autoSize bool

Optional, auto sizes the handles based on position and handle size.

recordUndo bool

Optional, records undo state.

Returns

Vector3

The new Vector3 value.

SquareMoveHandle(Object, Vector3, float, float, float, float, bool, bool)

Draw a square move handle.

public static Vector3 SquareMoveHandle(UnityEngine.Object target, Vector3 position, float xScale = 1, float yScale = 1, float zScale = 1, float handleSize = 0.2, bool autoSize = true, bool recordUndo = true)

Parameters

target UnityEngine.Object

UnityEngine.Object that is undergoing the transformation. Also used for recording undo.

position Vector3

The position to draw the handle.

xScale float

Scale the new value on the x axis by this amount.

yScale float

Scale the new value on the x axis by this amount.

zScale float

Scale the new value on the x axis by this amount.

handleSize float

Optional handle size.

autoSize bool

Optional, auto sizes the handles based on position and handle size.

recordUndo bool

Optional, records undo state.

Returns

Vector3

The new Vector3 value.

VectorHandle(Object, Vector3, Vector3, bool, bool, float, float, bool, bool)

Draw a vector handle.

public static Vector3 VectorHandle(UnityEngine.Object target, Vector3 origin, Vector3 vector, bool normalize = true, bool clamp = true, float handleLength = 1, float handleSize = 0.1, bool recordUndo = true, bool autoSize = true)

Parameters

target UnityEngine.Object

UnityEngine.Object that is undergoing the transformation. Also used for recording undo.

origin Vector3

vector Vector3

normalize bool

Optional, Normalize the new vector value.

clamp bool

Optional, Clamp new vector's value based on the distance to the origin.

handleLength float

Optional, handle length.

handleSize float

Optional, handle size.

recordUndo bool

Optional, records undo state.

autoSize bool

Optional, auto sizes the handles based on position and handle size.

Returns

Vector3

The new Vector3 value.