Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

RPC Calls on the right GameObject

$
0
0
Hello, 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

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>