disabling all scripts not attached to client player.

Im creating a physics based game that is multiplayer, there is one problem. my method of moving the player involves using its 2d rigidbody to pull the players character to the mouses position. what i want to do is keep the clients script active while disabling all of the other players scripts on the client end, because what is happening is that the clients player works fine but what happens is that the enemy's player gets pulled toward the mouse position on the clients end. resulting in glitchy movement as the enemy's player is rapidly jumping back to place (because of the enemy's client)

hopefully that makes sense, this is my first multiplayer project.
ive been googling this for the past 3 hours and cant find an answer

tldr: if player is not me then disable script.

Comments

  • Hi @brendenderp,

    since those objects have an attached PhotonView component, you can use it's isMine condition to handle input only on the client who is the owner of the object. To use it, you can basically add if (photonView.isMine) { HandleInput; } before any input handling. If your entire (Fixed)Update function is just input handling, you can add if (!photonView.isMine) { return; } to the beginning of that function.