MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

No way to set Interactable / Checkbox to checked on start?

Open genereddick opened this issue 7 years ago • 5 comments

Overview

I can't seem to find any way to set an Interactable / checkbox to start checked.

Expected Behavior

Property that allows setting checkbox to checked

Actual Behavior

Can't find property

Steps to reproduce

(Links to sample github project preferred)

Unity Editor Version

2018.3.8f1

Mixed Reality Toolkit Release Version

vNext Beta 2

genereddick avatar Mar 11 '19 18:03 genereddick

Achievable like this:

  1. in MixedRealityToolkit.SDK\Features\UX\Interactable\Scripts\Interactable.cs script add a field public int DefaultDimension = 0;
  2. at the end of Awake() method set the dimension index like this: SetDimensionIndex(DefaultDimension);
  3. to expose it in inspector add these 2 lines in MixedRealityToolkit.SDK\Inspectors\UX\Interactable\InteractableInspector.cs inside RenderCustomInspector() method:
SerializedProperty defaultDimension = serializedObject.FindProperty("DefaultDimension");
defaultDimension.intValue = EditorGUILayout.IntField(new GUIContent("Default Dimension", "Active dimension on start"), defaultDimension.intValue);

Set the "Default Dimension" to 1 in inspector if you want your toggle to be "Selected" by default

kolodi avatar Apr 23 '19 14:04 kolodi

Created PR #5069 for potential fix. I know it's more than what we are asking here. https://github.com/microsoft/MixedRealityToolkit-Unity/pull/5069

killerantz avatar Jun 26 '19 18:06 killerantz

fixed

Yoyozilla avatar Aug 02 '19 09:08 Yoyozilla

Finally, what is the property to know if a checkbox is checked ? or to check/uncheck it ?

ZAO29 avatar Mar 31 '21 07:03 ZAO29

I believe it's IsToggled.

killerantz avatar Mar 31 '21 14:03 killerantz