RPC Calls on the right GameObject


I am new to Photon and have wrapped up my Project to use the basics of PUN 2 by now.

My Problem is the following:
You can think of games like Diablo 3 and Path of Exile, basically Action RPGs.
I have a Character which has a set of abilities. When the local Player uses this ability the following RPC-Command should be sent to the network, so that this specific GameObject of the player performs the animation, which is stored in the Ability itself using a AnimatorOverrideController. The GameObjects of other Players also have the AbilityComponents of that player.

//Called like this photonView.RPC("playAnimation", RpcTarget.Others, abilityIndex, target, player.photonView); [PunRPC] private void playAnimation(int abilityIndex, Vector3 target, PhotonView view) { abilities[abilityIndex].Use(target); }

An ability is split into two parts:
  1. The Ability Config (Scriptable Object)
  2. The Ability Behaviour, which is added in runtime to each Player according to his selected Abilities
So when Player 1 uses his Ability A, this information should be send to all Other clients, where the specific GameObject then Uses the ability (plays sound, animation, particles etc.)

Right now this its not working.. the animation is indeed called on the local Player. If you need more code let me know.

Maybe you have another solution to this problem.

Thanks in advance


  • Hi @Pflicker,

    when you use the RPC function, what are the target and player.photonView parameters and what types are they? What do you intent to do with them?

    Two questions in general: are there any errors logged to the console? Is the RPC received and processed on the other client(s)?

    Since you mentioned, that the ability is added at runtime: can you confirm that it is the exact same on all connected clients?

    About the animation: is there any other component, that might overwrite the animation received with the RPC? For example an attached PhotonAnimatorView component?
Sign In or Register to comment.