We've moved!

Starting from MRTK 2.6, we are publishing both conceptual docs and API references on docs.microsoft.com. For conceptual docs, please visit our new landing page. For API references, please visit the MRTK-Unity section of the dot net API explorer. Existing content will remain here but will not be updated further.

Search Results for

    Show / Hide Table of Contents

    Class ColorPicker

    Example script to demonstrate adding buttons, sliders and a touchable gradient to control material values at runtime.

    Inheritance
    Object
    ColorPicker
    Implements
    IMixedRealityTouchHandler
    Namespace: Microsoft.MixedReality.Toolkit.Experimental.ColorPicker
    Assembly: cs.temp.dll.dll
    Syntax
    public class ColorPicker : MonoBehaviour, IMixedRealityTouchHandler

    Properties

    TargetObjectMesh

    Declaration
    public MeshRenderer TargetObjectMesh { get; set; }
    Property Value
    Type Description
    MeshRenderer

    TargetObjectSprite

    Declaration
    public SpriteRenderer TargetObjectSprite { get; set; }
    Property Value
    Type Description
    SpriteRenderer

    Methods

    ClickGradientTexture(MixedRealityPointerEventData)

    Touching the gradient texture will calculate the color and constrain the dragger based on the point in eventData

    Declaration
    public void ClickGradientTexture(MixedRealityPointerEventData eventData)
    Parameters
    Type Name Description
    MixedRealityPointerEventData eventData

    ExtractColorFromMaterial(MeshRenderer)

    Extracts a color from a MeshRenderer and applies it to the color picker

    Declaration
    public void ExtractColorFromMaterial(MeshRenderer meshRenderer)
    Parameters
    Type Name Description
    MeshRenderer meshRenderer

    StartDrag(GameObject)

    Tells the update loop that a slider knob is being dragged

    Declaration
    public void StartDrag(GameObject dragger)
    Parameters
    Type Name Description
    GameObject dragger

    StartDragGradient()

    Tells the update loop that the gradient is being dragged

    Declaration
    public void StartDragGradient()

    StopDrag(GameObject)

    Tells the update loop that a slider knob is not being dragged and applies the value to all sliders

    Declaration
    public void StopDrag(GameObject dragger)
    Parameters
    Type Name Description
    GameObject dragger

    StopDragGradient()

    Tells the update loop that the gradient is not being dragged, and applies the updated color value to the sliders

    Declaration
    public void StopDragGradient()

    SummonColorPicker(GameObject)

    This will set the visibility, scale, and position of the color picker while extracting the color of the touched object's MeshRenderer or SpriteRender

    Declaration
    public void SummonColorPicker(GameObject container)
    Parameters
    Type Name Description
    GameObject container

    UpdateColorHSV()

    Applies Hue, Saturation, Brightness slider values to the Red, Green, Blue sliders

    Declaration
    public void UpdateColorHSV()

    UpdateColorRGB()

    Applies Red, Green, Blue slider values to the Hue, Saturation, Brightness sliders

    Declaration
    public void UpdateColorRGB()

    Implements

    IMixedRealityTouchHandler
    In This Article
    Back to top Generated by DocFX