private static void ResetDevice(InputDevice device, bool hard)
        {
            var playerUpdateType  = InputDeviceDebuggerWindow.DetermineUpdateTypeToShow(device);
            var currentUpdateType = InputState.currentUpdateType;

            InputStateBuffers.SwitchTo(InputSystem.s_Manager.m_StateBuffers, playerUpdateType);
            InputSystem.ResetDevice(device, alsoResetDontResetControls: hard);
            InputStateBuffers.SwitchTo(InputSystem.s_Manager.m_StateBuffers, currentUpdateType);
        }
        private void DrawControlTree()
        {
            GUILayout.BeginHorizontal(EditorStyles.toolbar);
            GUILayout.Label("Controls", GUILayout.MinWidth(100), GUILayout.ExpandWidth(true));
            GUILayout.FlexibleSpace();

            // Allow plugins to add toolbar buttons.
            for (var i = 0; i < s_OnToolbarGUIActions.length; ++i)
            {
                s_OnToolbarGUIActions[i](m_Device);
            }

            if (GUILayout.Button(Contents.stateContent, EditorStyles.toolbarButton))
            {
                var window = CreateInstance <InputStateWindow>();
                window.InitializeWithControl(m_Device);
                window.Show();
            }

            GUILayout.EndHorizontal();

            ////TODO: detect if dynamic is disabled and fall back to fixed
            var updateTypeToShow = EditorApplication.isPlaying ? InputUpdateType.Dynamic : InputUpdateType.Editor;

            try
            {
                // Switch to buffers that we want to display in the control tree.
                InputStateBuffers.SwitchTo(InputSystem.s_Manager.m_StateBuffers, updateTypeToShow);

                ////REVIEW: I'm not sure tree view needs a scroll view or whether it does that automatically
                m_ControlTreeScrollPosition = EditorGUILayout.BeginScrollView(m_ControlTreeScrollPosition);
                var rect = EditorGUILayout.GetControlRect(GUILayout.ExpandHeight(true));
                m_ControlTree.OnGUI(rect);
                EditorGUILayout.EndScrollView();
            }
            finally
            {
                // Switch back to editor buffers.
                InputStateBuffers.SwitchTo(InputSystem.s_Manager.m_StateBuffers, InputUpdateType.Editor);
            }
        }
Example #3
0
 public void SwitchToLocalState()
 {
     InputSystem.s_Manager = localManager;
     InputStateBuffers.SwitchTo(localManager.m_StateBuffers, localManager.defaultUpdateType);
 }
Example #4
0
 public void SwitchToRemoteState()
 {
     InputSystem.s_Manager = remoteManager;
     InputStateBuffers.SwitchTo(remoteManager.m_StateBuffers, remoteManager.defaultUpdateType);
 }