/// <summary> /// Toggles a pointer's "enabled" behavior. If a pointer's <see cref="Microsoft.MixedReality.Toolkit.Input.PointerBehavior"/> is Default or AlwaysOn, /// set it to AlwaysOff. Otherwise, set the pointer's behavior to Default. /// Will set this state for all matching pointers. /// </summary> /// <typeparam name="T">Type of pointer to set</typeparam> /// <param name="inputType">Input type of pointer to set</param> public void TogglePointerEnabled <T>(InputSourceType inputType) where T : class, IMixedRealityPointer { PointerBehavior oldBehavior = PointerUtils.GetPointerBehavior <T>(Handedness.Any, inputType); PointerBehavior newBehavior; if (oldBehavior == PointerBehavior.AlwaysOff) { newBehavior = PointerBehavior.Default; } else { newBehavior = PointerBehavior.AlwaysOff; } PointerUtils.SetPointerBehavior <T>(newBehavior, inputType); }