コード例 #1
0
        public virtual void Setup()
        {
            // Disable input debugger so we don't waste time responding to all the
            // input system activity from the tests.
            #if UNITY_EDITOR
            InputDebuggerWindow.Disable();
            #endif

            // Push current input system state on stack.
            InputSystem.Save();

            // Put system in a blank state where it has all the layouts but has
            // none of the native devices.
            InputSystem.Reset();

            // Replace native input runtime with test runtime.
            testRuntime = new InputTestRuntime();
            InputSystem.s_Manager.InstallRuntime(testRuntime);
            InputSystem.s_Manager.InstallGlobals();

            #if UNITY_EDITOR
            // Make sure we're not affected by the user giving focus away from the
            // game view.
            InputConfiguration.LockInputToGame = true;
            #endif

            if (InputSystem.devices.Count > 0)
            {
                Assert.Fail("Input system should not have devices after reset");
            }
        }