Search Unity

Third Party [Photon] issue with synchronization

Discussion in 'Multiplayer' started by aenxgl, Aug 20, 2022.

  1. aenxgl

    aenxgl

    Joined:
    Jul 24, 2022
    Posts:
    3
    Hello,
    I'm new to Photon since today. I want to create a multiplayer dodgeball game.
    - There are 4 Balls on each side. (=8) You can pick up one ball and throw it.
    I setup Photon and the player instantiation and the movement of the players who joined is working pretty fine.
    But it's not possible to see if a player has picked up a ball neither if he is throwing it. I tried it tall day but I dont find a solution for that.
    So my question:
    - How can I synchronize Gameobjects (=Balls) (which are already in the game, no spawn) so, that everyone can see that that they are picked up and are being thrown?
    I hope someone can help me

    thank you very much
     
  2. Foestar

    Foestar

    Joined:
    Aug 12, 2013
    Posts:
    350
    Use Photon Transform View to sync your location, rotation and scale. RPC's are your method of sending information like whether a door is shut or not. This can also be used to tick whether the ball was thrown.

    So an RPC sent to each player when the player throws the ball to check a bool that is true. Then if it collides with another player while the bool is true you do an action.
     
    aenxgl likes this.
  3. aenxgl

    aenxgl

    Joined:
    Jul 24, 2022
    Posts:
    3
    Hello Foestar,
    thank you very much for your solution - i will try this out as soon i get to code
     
  4. aenxgl

    aenxgl

    Joined:
    Jul 24, 2022
    Posts:
    3
    So indeed the throw action is now viewable for everyone. But whats not working is:
    - By pickung ab the Ball the ball is getting set as a child of the hand (so transform.setparent) -> this is not to see for everyone
    - also is the direction wrong when you throw the ball - it always throws to the right and also uses other balls as that one, who is in the hand