private void OnDisable()
 {
     _placementIndicator.gameObject.SetActive(false);
     placedObject.GetComponentsInChildren <MeshRenderer>()[0].enabled = false;
     UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerDown        -= FingerDown;
     EnhancedTouchSupport.Disable();
 }
Ejemplo n.º 2
0
    public void Performance_TwoTouchesOverThreeFrames(bool enableEnhancedTouch)
    {
        InputSystem.AddDevice <Touchscreen>();

        if (enableEnhancedTouch)
        {
            EnhancedTouchSupport.Enable();
        }

        Measure.Method(() =>
        {
            BeginTouch(1, new Vector2(123, 234));

            BeginTouch(2, new Vector2(234, 345), queueEventOnly: true);
            MoveTouch(1, new Vector2(345, 456), queueEventOnly: true);
            MoveTouch(1, new Vector2(456, 567), queueEventOnly: true);
            MoveTouch(1, new Vector2(567, 678), queueEventOnly: true);
            MoveTouch(1, new Vector2(789, 890), queueEventOnly: true);
            InputSystem.Update();

            EndTouch(1, new Vector2(111, 222), queueEventOnly: true);
            EndTouch(2, new Vector2(111, 222), queueEventOnly: true);
            InputSystem.Update();
        })
        .MeasurementCount(100)
        .WarmupCount(5)
        .Run();
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Disable the Enhanced Touch System, disable the Action Maps, and dispose of the control system.
 /// </summary>
 private void OnDisable()
 {
     EnhancedTouchSupport.Disable();
     controls.Play.Disable();
     controls.Touch.Disable();
     controls.Dispose();
 }
Ejemplo n.º 4
0
    void Start()
    {
        m_Data = new TouchProcessData[kCount];
        for (int i = 0; i < kCount; i++)
        {
            m_Data[i] = new TouchProcessData();
        }

        m_JavaClass = new AndroidJavaObject("com.unity3d.player.ExtendedUnityPlayer");
        if (m_JavaClass == null)
        {
            throw new Exception("Failed to find com.unity3d.player.ExtendedUnityPlayer");
        }
        m_UsingNewInputSystem = false;
        m_UsingOldInputSystem = false;
#if ENABLE_INPUT_SYSTEM
        m_UsingNewInputSystem = true;
#endif
#if ENABLE_LEGACY_INPUT_MANAGER
        m_UsingOldInputSystem = true;
#endif

        if (m_UsingNewInputSystem)
        {
            EnhancedTouchSupport.Enable();
            InputSystem.onEvent += InputSystem_onEvent;
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Enable the control system, enable the action maps, and enable the Enhanced Touch System.
 /// </summary>
 private void OnEnable()
 {
     controls = new InputMaster();
     controls.Touch.Enable();
     controls.Play.Enable();
     EnhancedTouchSupport.Enable();
 }
Ejemplo n.º 6
0
        static void RuntimeInit()
        {
            if (!Debug.isDebugBuild || FindObjectOfType <DebugUpdater>() != null)
            {
                return;
            }

            var go = new GameObject {
                name = "[Debug Updater]"
            };
            var debugUpdater = go.AddComponent <DebugUpdater>();

            var es = GameObject.FindObjectOfType <EventSystem>();

            if (es == null)
            {
                go.AddComponent <EventSystem>();
#if USE_INPUT_SYSTEM
                // FIXME: InputSystemUIInputModule has a quirk where the default actions fail to get initialized if the
                // component is initialized while the GameObject is active. So we deactivate it temporarily.
                // See https://fogbugz.unity3d.com/f/cases/1323566/
                go.SetActive(false);
                go.AddComponent <InputSystemUIInputModule>();
                go.SetActive(true);
                EnhancedTouchSupport.Enable();
#else
                go.AddComponent <StandaloneInputModule>();
#endif
            }

            debugUpdater.m_Orientation = Screen.orientation;

            DontDestroyOnLoad(go);
        }
    private void OnEnable()
    {
        m_CubeOffsetFromCanvas = rotatingCube.position.z - transform.position.z;
        m_CubeStartingPosition = rotatingCube.position;

        EnhancedTouchSupport.Enable();
    }
Ejemplo n.º 8
0
        protected void Awake()
        {
            playerInput.onDeviceChange += OnDeviceChange;
            m_InitialCameraState.SetFromTransform(transform);

            // Need to set enable the flag to receive touch screen event from mobile devices.
            EnhancedTouchSupport.Enable();
        }
Ejemplo n.º 9
0
    public void EnhancedTouch_CanBeDisabledAndEnabled_WithoutTouchscreenPresent()
    {
        EnhancedTouchSupport.Enable();
        Assert.That(EnhancedTouchSupport.enabled, Is.True);

        EnhancedTouchSupport.Disable();
        Assert.That(EnhancedTouchSupport.enabled, Is.False);
    }
Ejemplo n.º 10
0
    private void Awake()
    {
        //Enable support for the new Enhanced Touch API and testing with the mouse
        EnhancedTouchSupport.Enable();

        //Uncomment the next line if you are using mouse to simulate touch
        //TouchSimulation.Enable();
    }
Ejemplo n.º 11
0
 public void OnDestroy()
 {
     Instance = null;
     EnhancedTouchSupport.Disable();
     WebRTC.WebRTC.Dispose();
     RemoteInputReceiver.Dispose();
     Unity.WebRTC.Audio.Stop();
 }
 public static void Initialize()
 {
     Keyboard    = InputSystem.AddDevice <Keyboard>();
     RemoteMouse = InputSystem.AddDevice <Mouse>();
     EnhancedTouchSupport.Enable();
     RemoteTouch     = InputSystem.AddDevice <Touchscreen>();
     m_isInitialized = true;
 }
Ejemplo n.º 13
0
    void Start()
    {
        mainCamera = Camera.main;

        EnhancedTouchSupport.Enable();

        SpawnNewBall();
    }
        public override void TearDown()
        {
            TestUtilities.DestroyAllSceneObjects();

            GestureTouchesUtility.touchInputSource = GestureTouchesUtility.defaultTouchInputSource;
            EnhancedTouchSupport.Disable();

            base.TearDown();
        }
Ejemplo n.º 15
0
 private void Start()
 {
     EnhancedTouchSupport.Enable();
     TouchSimulation.Enable();
     Debug.Log("TouchSimulation Enabled!");
     cam = transform.GetChild(0).GetComponent <Camera>();
     UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerDown += OnFingerDown;
     UnityEngine.InputSystem.EnhancedTouch.Touch.onFingerUp   += OnFingerUp;
 }
Ejemplo n.º 16
0
        public void Awake()
        {
            Instance = this;
            var encoderType = hardwareEncoderSupport ? EncoderType.Hardware : EncoderType.Software;

            WebRTC.WebRTC.Initialize(encoderType);
            m_defaultInput = new DefaultInput();
            EnhancedTouchSupport.Enable();
        }
        void Awake()
        {
            if (receiver == null)
            {
                receiver = GetComponent <InputChannelReceiverBase>();
            }
            receiver.onDeviceChange += OnDeviceChange;

            EnhancedTouchSupport.Enable();
        }
Ejemplo n.º 18
0
 private void Start()
 {
     if (Touchscreen.current != null &&
         !EnhancedTouchSupport.enabled)
     {
         // Enable EnhancedTouchSupport to make use of EnhancedTouch.Touch struct etc.
         EnhancedTouchSupport.Enable();
     }
     ContextMenu.OpenContextMenus.Clear();
 }
Ejemplo n.º 19
0
        public void Awake()
        {
            Instance = this;
            var encoderType = hardwareEncoderSupport ? EncoderType.Hardware : EncoderType.Software;

            WebRTC.WebRTC.Initialize(encoderType);
            m_defaultInput = new DefaultInput();
            EnhancedTouchSupport.Enable();
            m_mainThreadContext = SynchronizationContext.Current;
        }
Ejemplo n.º 20
0
    public void EnhancedTouch_CanBeDisabledAndEnabled()
    {
        InputSystem.AddDevice <Touchscreen>();

        EnhancedTouchSupport.Enable();
        Assert.That(EnhancedTouchSupport.enabled, Is.True);

        EnhancedTouchSupport.Disable();
        Assert.That(EnhancedTouchSupport.enabled, Is.False);
    }
Ejemplo n.º 21
0
 public static void Initialize()
 {
     Keyboard    = InputSystem.AddDevice <Keyboard>();
     RemoteMouse = InputSystem.AddDevice <Mouse>();
     EnhancedTouchSupport.Enable();
     RemoteTouch     = InputSystem.AddDevice <Touchscreen>();
     GamepadsStates  = new Dictionary <double, GamepadState>();
     GamepadsMap     = new Dictionary <double, int>();
     m_isInitialized = true;
 }
//---------------------------------------------------------------------------------------------------------------------
        public static void Destroy()
        {
            InputSystem.RemoveDevice(RemoteMouse);
            InputSystem.RemoveDevice(Keyboard);
            EnhancedTouchSupport.Disable();
            InputSystem.RemoveDevice(RemoteTouch);
            RemoteMouse     = null;
            Keyboard        = null;
            RemoteTouch     = null;
            m_isInitialized = false;
        }
Ejemplo n.º 23
0
        private void Awake()
        {
            _camera    = Camera.main;
            _isAlive   = true;
            _rigidbody = GetComponent <Rigidbody2D>();

#if !UNITY_EDITOR
            if (photonView.IsMine)
            {
                EnhancedTouchSupport.Enable();
                Touch.onFingerDown += OnScreenClicked;
            }
#endif
        }
Ejemplo n.º 24
0
        public override void TearDown()
        {
            TestUtilities.DestroyAllInteractionObjects();

            if (s_TestPlane != null)
            {
                Object.DestroyImmediate(s_TestPlane);
            }
            if (m_ARSessionOrigin != null)
            {
                Object.DestroyImmediate(m_ARSessionOrigin.gameObject);
            }

            GestureTouchesUtility.touchInputSource = GestureTouchesUtility.defaultTouchInputSource;
            EnhancedTouchSupport.Disable();

            base.TearDown();
        }
Ejemplo n.º 25
0
    public override void Setup()
    {
        base.Setup();

        // Disable() will not reset this so default initialize it here.
        Touch.s_HistoryLengthPerFinger = 64;

        if (!TestContext.CurrentContext.Test.Properties.ContainsKey("EnhancedTouchDisabled"))
        {
            InputSystem.AddDevice <Touchscreen>();
            EnhancedTouchSupport.Enable();
        }

        // Make sure we don't run into interference with a TouchSimulation instance that may
        // already be in place.
        m_OldTouchSimulationInstance = TouchSimulation.s_Instance;
        TouchSimulation.s_Instance   = null;
    }
Ejemplo n.º 26
0
//---------------------------------------------------------------------------------------------------------------------
        public static void Destroy()
        {
            InputSystem.RemoveDevice(RemoteMouse);
            InputSystem.RemoveDevice(Keyboard);
            EnhancedTouchSupport.Disable();
            InputSystem.RemoveDevice(RemoteTouch);
            var totalRemoteGamepads = Gamepad.all.Count - GamepadsMap.Count;

            for (int i = Gamepad.all.Count - 1; i >= totalRemoteGamepads; i--)
            {
                InputSystem.RemoveDevice(Gamepad.all[i]);
            }
            GamepadsStates.Clear();
            RemoteMouse     = null;
            Keyboard        = null;
            RemoteTouch     = null;
            m_isInitialized = false;
        }
Ejemplo n.º 27
0
    public IEnumerator InputEventsArePropagated()
    {
        EnhancedTouchSupport.Enable();
        var plugin = new InputSystemPlugin();

        plugin.OnCreate();
        yield return(null);

        plugin.OnTouchEvent(CreateTouch(0, new Vector2(5, 5), UnityEditor.DeviceSimulation.TouchPhase.Began));
        yield return(null);

        var activeTouches = Touch.activeTouches;

        Assert.Greater(activeTouches.Count, 0);
        Assert.AreEqual(new Vector2(5, 5), Touch.activeTouches[0].screenPosition);
        Assert.AreEqual(TouchPhase.Began, Touch.activeTouches[0].phase);

        yield return(null);

        Assert.AreEqual(new Vector2(5, 5), Touch.activeTouches[0].screenPosition);
        Assert.AreEqual(TouchPhase.Stationary, Touch.activeTouches[0].phase);

        plugin.OnTouchEvent(CreateTouch(0, new Vector2(10, 10), UnityEditor.DeviceSimulation.TouchPhase.Moved));
        yield return(null);

        Assert.AreEqual(new Vector2(10, 10), Touch.activeTouches[0].screenPosition);
        Assert.AreEqual(TouchPhase.Moved, Touch.activeTouches[0].phase);

        plugin.OnTouchEvent(CreateTouch(0, new Vector2(5, 5), UnityEditor.DeviceSimulation.TouchPhase.Ended));
        yield return(null);

        Assert.AreEqual(new Vector2(5, 5), Touch.activeTouches[0].screenPosition);
        Assert.AreEqual(TouchPhase.Ended, Touch.activeTouches[0].phase);

        yield return(null);

        Assert.AreEqual(Touch.activeTouches.Count, 0);

        plugin.OnDestroy();
        EnhancedTouchSupport.Disable();
    }
Ejemplo n.º 28
0
    public override void TearDown()
    {
        EnhancedTouchSupport.Disable();

        // Make sure cleanup really did clean up.
        Assert.That(Touch.s_Touchscreens.length, Is.EqualTo(0));
        Assert.That(Touch.s_PlayerState, Is.EqualTo(default(Touch.FingerAndTouchState)));
        #if UNITY_EDITOR
        Assert.That(Touch.s_EditorState, Is.EqualTo(default(Touch.FingerAndTouchState)));
        #endif

        // Some state is kept alive in-between Disable/Enable. Manually clean it out.
        Touch.s_OnFingerDown = new InlinedArray <Action <Finger> >();
        Touch.s_OnFingerUp   = new InlinedArray <Action <Finger> >();
        Touch.s_OnFingerMove = new InlinedArray <Action <Finger> >();

        TouchSimulation.Destroy();
        TouchSimulation.s_Instance   = m_OldTouchSimulationInstance;
        m_OldTouchSimulationInstance = null;

        base.TearDown();
    }
Ejemplo n.º 29
0
        static void EnableRuntime()
        {
            if (s_Instance != null)
            {
                return;
            }

            var go = new GameObject {
                name = "[Debug Updater]"
            };

            s_Instance = go.AddComponent <DebugUpdater>();
            s_Instance.m_Orientation = Screen.orientation;

            DontDestroyOnLoad(go);

            DebugManager.instance.EnableInputActions();

#if USE_INPUT_SYSTEM
            EnhancedTouchSupport.Enable();
#endif
        }
Ejemplo n.º 30
0
 private void Awake()
 {
     // Cachen
     _imageManager   = GetComponent <ARTrackedImageManager>();
     _raycastManager = GetComponent <ARRaycastManager>();
     _anchorManager  = GetComponent <ARAnchorManager>();
     _planeManager   = GetComponent <ARPlaneManager>();
     _session        = GetComponent <ARSessionOrigin>();
     // Manager zunaechst deaktivieren
     _raycastManager.subsystem?.Stop();
     _planeManager.subsystem?.Stop();
     _imageManager.subsystem?.Stop();
     // IFC instantiieren
     GameManager.Instance.PlacedIFC = Instantiate(_placedPrefab);
     GameManager.Instance.PlacedIFC.SetActive(false);
     // Event abonnieren
     GameManager.Instance.PlacementModeSelected += X_ModeSelected;
     // ggf. Touch aktivieren
     if (!EnhancedTouchSupport.enabled)
     {
         EnhancedTouchSupport.Enable();
     }
 }