{"_id":"594949e92be16d0026ec0555","category":{"_id":"594949e62be16d0026ec04d5","version":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-01-01T16:48:47.829Z","from_sync":false,"order":7,"slug":"highlighters","title":"Highlighters"},"project":"571fa55ca0acd42000af9545","user":"571fa519db52d01700f5cf3d","parentDoc":null,"version":{"_id":"594949e52be16d0026ec04cd","project":"571fa55ca0acd42000af9545","__v":2,"createdAt":"2017-06-20T16:14:29.816Z","releaseDate":"2017-06-20T16:14:29.816Z","categories":["594949e62be16d0026ec04ce","594949e62be16d0026ec04cf","594949e62be16d0026ec04d0","594949e62be16d0026ec04d1","594949e62be16d0026ec04d2","594949e62be16d0026ec04d3","594949e62be16d0026ec04d4","594949e62be16d0026ec04d5","594949e62be16d0026ec04d6","594949e62be16d0026ec04d7","594949e62be16d0026ec04d8","594949e62be16d0026ec04d9","594949e62be16d0026ec04da","594949e62be16d0026ec04db","594949e62be16d0026ec04dc","594949e62be16d0026ec04dd","594949e62be16d0026ec04de","594949e62be16d0026ec04df","594949e62be16d0026ec04e0","594949e62be16d0026ec04e1","59497219f4a8980024dd0631"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"Kunekune","version_clean":"3.2.0","version":"3.2.0"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-01-01T16:49:32.288Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"> extends [VRTK_BaseHighlighter](doc:vrtk_basehighlighter)\n\n## Overview\n\nThe Material Colour Swap Highlighter is a basic implementation that simply swaps the texture colour for the given highlight colour.\n\nDue to the way the object material is interacted with, changing the material colour will break Draw Call Batching in Unity whilst the object is highlighted.\n\nThe Draw Call Batching will resume on the original material when the item is no longer highlighted.\n\nThis is the default highlighter that is applied to any script that requires a highlighting component (e.g. `VRTK_Interactable_Object`).\n\n## Inspector Parameters\n\n * **Emission Darken:** The emission colour of the texture will be the highlight colour but this percent darker.\n * **Custom Material:** A custom material to use on the highlighted object.\n\n## Class Methods\n\n### Initialise/2\n\n  > `public override void Initialise(Color? color = null, Dictionary<string, object> options = null)`\n\n  * Parameters\n   * `Color? color` - Not used.\n   * `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.\n  * Returns\n   * _none_\n\nThe Initialise method sets up the highlighter for use.\n\n### ResetHighlighter/0\n\n  > `public override void ResetHighlighter()`\n\n  * Parameters\n   * _none_\n  * Returns\n   * _none_\n\nThe ResetHighlighter method stores the object's materials and shared materials prior to highlighting.\n\n### Highlight/2\n\n  > `public override void Highlight(Color? color, float duration = 0f)`\n\n  * Parameters\n   * `Color? color` - The colour to highlight to.\n   * `float duration` - The time taken to fade to the highlighted colour.\n  * Returns\n   * _none_\n\nThe Highlight method initiates the change of colour on the object and will fade to that colour (from a base white colour) for the given duration.\n\n### Unhighlight/2\n\n  > `public override void Unhighlight(Color? color = null, float duration = 0f)`\n\n  * Parameters\n   * `Color? color` - Not used.\n   * `float duration` - Not used.\n  * Returns\n   * _none_\n\nThe Unhighlight method returns the object back to it's original colour.\n\n## Example\n\n`VRTK/Examples/005_Controller_BasicObjectGrabbing` demonstrates the solid highlighting on the green cube, red cube and flying saucer when the controller touches it.\n\n`VRTK/Examples/035_Controller_OpacityAndHighlighting` demonstrates the solid highlighting if the right controller collides with the green box or if any of the buttons are pressed.","excerpt":"","slug":"vrtk_materialcolorswaphighlighter","type":"basic","title":"VRTK_MaterialColorSwapHighlighter"}

VRTK_MaterialColorSwapHighlighter


> extends [VRTK_BaseHighlighter](doc:vrtk_basehighlighter) ## Overview The Material Colour Swap Highlighter is a basic implementation that simply swaps the texture colour for the given highlight colour. Due to the way the object material is interacted with, changing the material colour will break Draw Call Batching in Unity whilst the object is highlighted. The Draw Call Batching will resume on the original material when the item is no longer highlighted. This is the default highlighter that is applied to any script that requires a highlighting component (e.g. `VRTK_Interactable_Object`). ## Inspector Parameters * **Emission Darken:** The emission colour of the texture will be the highlight colour but this percent darker. * **Custom Material:** A custom material to use on the highlighted object. ## Class Methods ### Initialise/2 > `public override void Initialise(Color? color = null, Dictionary<string, object> options = null)` * Parameters * `Color? color` - Not used. * `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. ### ResetHighlighter/0 > `public override void ResetHighlighter()` * Parameters * _none_ * Returns * _none_ The ResetHighlighter method stores the object's materials and shared materials prior to highlighting. ### Highlight/2 > `public override void Highlight(Color? color, float duration = 0f)` * Parameters * `Color? color` - The colour to highlight to. * `float duration` - The time taken to fade to the highlighted colour. * Returns * _none_ The Highlight method initiates the change of colour on the object and will fade to that colour (from a base white colour) for the given duration. ### 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. ## Example `VRTK/Examples/005_Controller_BasicObjectGrabbing` demonstrates the solid highlighting on the green cube, red cube and flying saucer when the controller touches it. `VRTK/Examples/035_Controller_OpacityAndHighlighting` demonstrates the solid highlighting if the right controller collides with the green box or if any of the buttons are pressed.