示例#1
0
    private void OnDisable()
    {
#if UNITY_EDITOR
        TouchSimulation.Disable();
#endif
        if (touchControls == null)
        {
            return;
        }

        touchControls.Disable();
        touchControls.Touch.TouchPress.started  -= On_TouchPressStarted;
        touchControls.Touch.TouchPress.canceled -= On_TouchPressCanceled;
    }
示例#2
0
    public void EnhancedTouch_CanEnableAndDisableTouchSimulation()
    {
        Assert.That(InputSystem.devices, Has.None.TypeOf <Touchscreen>());

        TouchSimulation.Enable();

        Assert.That(InputSystem.devices, Has.Exactly(1).TypeOf <Touchscreen>());
        Assert.That(TouchSimulation.instance, Is.Not.Null);
        Assert.That(TouchSimulation.instance.simulatedTouchscreen, Is.Not.Null);
        Assert.That(TouchSimulation.instance.simulatedTouchscreen, Is.SameAs(Touchscreen.current));

        TouchSimulation.Disable();

        Assert.That(InputSystem.devices, Has.None.TypeOf <Touchscreen>());

        // Make sure we can re-enable it.
        TouchSimulation.Enable();

        Assert.That(InputSystem.devices, Has.Exactly(1).TypeOf <Touchscreen>());

        TouchSimulation.Destroy();

        Assert.That(TouchSimulation.instance, Is.Null);
    }
 /// <summary>
 /// Disables when invoked or closed.
 /// </summary>
 protected void OnDisable()
 {
     EnhancedTouchSupport.Disable();
     TouchSimulation.Disable();
 }