Class ColorPicker
Example script to demonstrate adding buttons, sliders and a touchable gradient to control material values at runtime.
Implements
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()