class MAGES::Editor::Utilities::EditorGameObjectExtensions¶
Overview¶
Extensions for GameObject class. More…
class EditorGameObjectExtensions { public: // methods static bool TryGetSceneComponent< T >(this GameObject gameObject, out T component); static PropertyField AddPropertyFieldWithChangeCallback( this VisualElement element, SerializedProperty property, System.Action callback ); static void AddWithTooltip( this VisualElement container, VisualElement element, string tooltip ); static T Build< T >(this VisualElement container, T element); static T Tooltip< T >(this T element, string tooltip); static T Class< T >(this T element, string className); static T Label< T >(this T element, string label); static T Name< T >(this T element, string newName); static Label Text(this Label element, string text); static T Show< T >(this T element, bool show); static bool IsShown< T >(this T element); };
Detailed Documentation¶
Extensions for GameObject class.
Methods¶
static bool TryGetSceneComponent< T >( this GameObject gameObject, out T component )
Try get a component from the same scene as gameObject.
Parameters:
T |
The type of the component. |
gameObject |
A gameobject in the scene. |
component |
The component found, else |
Returns:
true
if a component was found.
static PropertyField AddPropertyFieldWithChangeCallback( this VisualElement element, SerializedProperty property, System.Action callback )
Add a property field with a change callback.
Parameters:
element |
The parent element. |
property |
The serialized property. |
callback |
Action to invoke when property is changed. |
Returns:
The created property field.
static void AddWithTooltip( this VisualElement container, VisualElement element, string tooltip )
Adds a visual element with a tooltip.
Parameters:
container |
The container. |
element |
The element to add. |
tooltip |
The tooltip to add to the element. |
static T Build< T >(this VisualElement container, T element)
Adds a visual element and returns the element as well. Useful for chaining.
Parameters:
T |
The element type. |
container |
The container element. |
element |
The element itself. |
Returns:
The new element.
static T Tooltip< T >(this T element, string tooltip)
Sets the tooltip of the element and returns the element as well.
Parameters:
T |
The element type. |
element |
The element. |
tooltip |
The tooltip. |
Returns:
Self.
static T Class< T >(this T element, string className)
Adds a class to the element and returns the element as well.
Parameters:
T |
The element type. |
element |
The element. |
className |
The class to add. |
Returns:
Self.
static T Label< T >(this T element, string label)
Sets the label of the element and returns the element as well.
Parameters:
T |
The element type. |
element |
The element. |
label |
The label. |
Returns:
Self.
static T Name< T >(this T element, string newName)
Sets the name of the element and returns the element as well.
Parameters:
T |
The element type. |
element |
The element. |
newName |
The new name. |
Returns:
Self.
static Label Text(this Label element, string text)
Sets the text of the label.
Parameters:
element |
The label. |
text |
The text of the label. |
Returns:
Self.
static T Show< T >(this T element, bool show)
Sets an element to be visible or not.
Parameters:
T |
The element type. |
element |
The element. |
show |
True to show. |
Returns:
Self.
static bool IsShown< T >(this T element)
Gets whether an element is shown or not.
Parameters:
T |
The element type. |
element |
The element. |
Returns:
A value indicating whether or not it’s shown.