VRTK_ObjectAppearance
Overview
The Object Appearance script provides a collection of static methods for controlling the appearance of a GameObject.
The GameObject can have it's opacity changed, or it's renderers toggled, or highlighters toggled.
Class Methods
SetOpacity/3
public static void SetOpacity(GameObject model, float alpha, float transitionDuration = 0f)
- Parameters
GameObject model
- The GameObject to change the renderer opacity on.float alpha
- The alpha level to apply to opacity of the controller object.0f
to1f
.float transitionDuration
- The time to transition from the current opacity to the new opacity.- Returns
- none
The SetOpacity method allows the opacity of the given GameObject to be changed. A lower alpha value will make the object more transparent, such as 0.5f
will make the controller partially transparent where as 0f
will make the controller completely transparent.
SetRendererVisible/2
public static void SetRendererVisible(GameObject model, GameObject ignoredModel = null)
- Parameters
GameObject model
- The GameObject to show the renderers for.GameObject ignoredModel
- An optional GameObject to ignore the renderer toggle on.- Returns
- none
The SetRendererVisible method turns on renderers of a given GameObject. It can also be provided with an optional model to ignore the render toggle on.
SetRendererHidden/2
public static void SetRendererHidden(GameObject model, GameObject ignoredModel = null)
- Parameters
GameObject model
- The GameObject to hide the renderers for.GameObject ignoredModel
- An optional GameObject to ignore the renderer toggle on.- Returns
- none
The SetRendererHidden method turns off renderers of a given GameObject. It can also be provided with an optional model to ignore the render toggle on.
ToggleRenderer/3
public static void ToggleRenderer(bool state, GameObject model, GameObject ignoredModel = null)
- Parameters
bool state
- If true then the renderers will be enabled, if false the renderers will be disabled.GameObject model
- The GameObject to toggle the renderer states of.GameObject ignoredModel
- An optional GameObject to ignore the renderer toggle on.- Returns
- none
The ToggleRenderer method turns on or off the renderers of a given GameObject. It can also be provided with an optional model to ignore the render toggle of.
HighlightObject/3
public static void HighlightObject(GameObject model, Color? highlightColor, float fadeDuration = 0f)
- Parameters
GameObject model
- The GameObject to attempt to call the Highlight on.Color? highlightColor
- The colour to highlight to.float fadeDuration
- The duration in time to fade from the initial colour to the target colour.- Returns
- none
The HighlightObject method calls the Highlight method on the highlighter attached to the given GameObject with the provided colour.
UnhighlightObject/1
public static void UnhighlightObject(GameObject model)
- Parameters
GameObject model
- The GameObject to attempt to call the Unhighlight on.- Returns
- none
The UnhighlightObject method calls the Unhighlight method on the highlighter attached to the given GameObject.
Updated less than a minute ago