VRTK_MaterialPropertyBlockColorSwapHighlighter
Overview
Swaps the texture colour on the Renderers material for the given highlight colour using property blocks.
Utilising the MaterialPropertyBlock means that Draw Call Batching in Unity is not compromised.
Script Usage:
- Place the
VRTK_MaterialPropertyBlockColorSwapHighlighter
script on either:- The GameObject of the Interactable Object to highlight.
- Any other scene GameObject and then link that GameObject to the Interactable Objects
Object Highlighter
parameter to denote use of the highlighter.
- Ensure the
Active
parameter is checked.
Class Methods
Initialise/3
public override void Initialise(Color? color = null, GameObject affectObject = null, Dictionary<string, object> options = null)
- Parameters
Color? color
- Not used.GameObject affectObject
- An optional GameObject to specify which object to apply the highlighting to.Dictionary<string, object> options
- A dictionary array containing the highlighter options:\r *<'resetMainTexture', bool>
- Determines if the default main texture should be cleared on highlight.true
to reset the main default texture,false
to not reset it.
- Returns
- none
The Initialise method sets up the highlighter for use.
Unhighlight/2
public override void Unhighlight(Color? color = null, float duration = 0f)
- Parameters
Color? color
- Not used.float duration
- Not used.
- Returns
- none
The Unhighlight method returns the object back to it's original colour.
Updated less than a minute ago