Exemple #1
0
        private static void InitializeInPlayer()
        {
            // No domain reloads in the player so we don't need to look for existing
            // instances.
            s_Manager = new InputManager();
            s_Manager.Initialize();

            ////TODO: put this behind a switch so that it is off by default
            // Automatically enable remoting in development players.
            #if DEVELOPMENT_BUILD
            s_ConnectionToEditor = ScriptableObject.CreateInstance <RemoteInputPlayerConnection>();
            s_Remote             = new InputRemoting(s_Manager, startSendingOnConnect: true);
            s_Remote.Subscribe(s_ConnectionToEditor);
            s_ConnectionToEditor.Subscribe(s_Remote);
            s_ConnectionToEditor.Bind(PlayerConnection.instance, PlayerConnection.instance.isConnected);
            #endif
        }
        private void SetUpRemoting()
        {
            remote = new InputRemoting(manager);
            remote.RestoreState(m_RemotingState, manager);

            if (playerConnection == null)
            {
                playerConnection = CreateInstance <RemoteInputPlayerConnection>();
            }

            remote.Subscribe(playerConnection); // Feed messages from players into editor.
            playerConnection.Subscribe(remote); // Feed messages from editor into players.

            playerConnection.Bind(EditorConnection.instance, false);

            // We don't enable sending on the editor's remote by default.
            // By default, the editor acts as a receiver only.

            m_RemotingState = new InputRemoting.SerializedState();
        }