-
I replaced all my toggles with the new PressableButton of the MRTK3. Before the update, I subscribed to "onValueChanged" of my Toggle element. Now this event does not exist anymore. The PressableButton offers "OnToggled" and "OnUntoggled" in the inspector. I cannot find the right way, to access these events in my code. The docu talks about the StatefulInteractable. But even this class does not offer those events. I could use some help. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Use the https://learn.microsoft.com/en-us/dotnet/api/mixedreality.toolkit.timedflag?view=mrtkcore-3.0 private void AddEventHandlers(PressableButton button)
{
button.IsToggled.OnEntered.AddListener(OnButtonToggledEntered);
button.IsToggled.OnExited.AddListener(OnButtonToggledExited);
}
private void RemoveEventHandlers(PressableButton button)
{
button.IsToggled.OnEntered.RemoveListener(OnButtonToggledEntered);
button.IsToggled.OnExited.RemoveListener(OnButtonToggledExited);
}
private void OnButtonToggledEntered(float value)
{
}
private void OnButtonToggledExited(float value)
{
} |
Beta Was this translation helpful? Give feedback.
-
@AMollis How do a read/write "IsInteractable" (Field also visible via inspector) |
Beta Was this translation helpful? Give feedback.
Use the
StatefulInteractable.IsToggled
TimedFlag
object. Types ofTimedFlag
have anOnEntered
andOnExited
event you can register to.https://learn.microsoft.com/en-us/dotnet/api/mixedreality.toolkit.statefulinteractable.istoggled?view=mrtkcore-3.0&viewFallbackFrom=mrtkuxcore-3.0#mixedreality-toolkit-statefulinteractable-istoggled
https://learn.microsoft.com/en-us/dotnet/api/mixedreality.toolkit.timedflag?view=mrtkcore-3.0