Search Unity

Question New Input System Controls All Multiplayer Clients

Discussion in 'Scripting' started by ClearRoseOfWar, Mar 18, 2022.

  1. ClearRoseOfWar

    ClearRoseOfWar

    Joined:
    Sep 6, 2015
    Posts:
    89
    Hello,


    NOTE: I am not sure if it IS the new input system's fault, but I am not willing to revert my game to work with the old input system to do any tests to find out for sure, as there should be a solution for my problem regardless.


    TLDR: My joystick is controlling all clients. But my keyboard works as intended and controls each client individually. Strange thing is, both keyboard and joystick schemes are running under the same input action.



    This isn't the first time I've handled multiplayer movement. In another project, I have clients using the new input system with joysticks working as intended.


    SO. That said, I use Photon and I am positive that I've blocked off all unnecessary code with PhotonView.IsMine or IsLocalPlayer effectively making the keyboard and mouse scheme operate as intended.. But not the joystick which should work interchangeably using the new input system.. Any Ideas?


    Note: I have done debug logs and the code is only running the movement code on the clients I want them to. In fact, I destroy the scripts I don't use on my clients (which the input script is one of them)

    Note: Even if I completely remove the input script at runtime (from the player) both players still move so im getting some really odd behavior that likely isn't related to pun, but I was wondering if anyone had some similar or exact issue before?



    Thank you for your time!
     
  2. ClearRoseOfWar

    ClearRoseOfWar

    Joined:
    Sep 6, 2015
    Posts:
    89
    I disabled the input script on the player and built the game; attempted to move player1 and player2; and neither moved.

    Then from the editor I enabled the input script on the local player and was then able to move my character, and the other character was not moving!!

    But thats when everything made less sense.

    I CAN CONTROL THE PLAYER ON EITHER CLIENT STILL...

    Neither players have any input unless that script is enabled, which it was only enabled on the one client. how is it controling that same player, from another window!?
     
  3. ClearRoseOfWar

    ClearRoseOfWar

    Joined:
    Sep 6, 2015
    Posts:
    89
    So, it turns out... lol... that it wasnt anything I did wrong. Using my pc and another pc in the house, I tested it out and it works fine. The problem is (I guess) that my joystick doesnt lock to one game window. It actually controls all windows (or at least that Ive tried for unity) -- luckily I can still test with my keyboard and mouse, but I think this might be a bug...
     
    Last edited: Mar 20, 2022
    barisdincer likes this.