Search Unity

Third Party [PHOTON] How to synchronize animations without using parameters and transitions

Discussion in 'Multiplayer' started by matreusz4, Sep 21, 2021.

  1. matreusz4

    matreusz4

    Joined:
    Jan 18, 2020
    Posts:
    13
    Hello. In my game I have really lots of animations. I found it better and easier for me to use animator.Play() or animator.CrossFade() in script instead of doing lot of trasintions and parameters. But so far as I noticed from tutorials, I can synchronize animations only by setting an parameter to synchronize, if I want to use Photon Animation View.

    Of course, I have parameters to decide when to play the animations, but these are things like "whether he presses 'W' and the left shift" than "whether is running".I just don't have the parameters set in the animator.

    So, do I have to rebuild my code and make animations play by parameters or there is any other solution? Each player object has a ChangeAnimationState () method. Couldn't I pass information from it describing the state of the current player to other players?
     
    Last edited: Sep 21, 2021
  2. saikarthi

    saikarthi

    Joined:
    Jan 24, 2019
    Posts:
    2
    I have the same question. if you found something let me know
     
  3. furkankaya0

    furkankaya0

    Joined:
    Oct 29, 2021
    Posts:
    1
    Did you find the answer??? :)
     
  4. mjkjx34

    mjkjx34

    Joined:
    Sep 19, 2021
    Posts:
    3
    Somebody?
     
  5. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,067
    If you say you want to play animations when something happens, then you already have some external "trigger" to play the animation. It should be possible to network synchronize those just fine. It's just that the PhotonAnimatorView is not the suitable component to do this.

    To a degree, PUN 2 expects you to come up with your own components that implement IPunObservable and then send whatever data you need synced (e.g. key presses). So .. go that route. It's not terribly complex.

    An example is in the PUN Basics Tutorial ("Health Synchronization"). It's also mentioned in the getting started section.