Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Third Party How to Synchronize an animation of a second Layer with Photon ?

Discussion in 'Multiplayer' started by ManitoBart, Jan 6, 2015.

  1. ManitoBart

    ManitoBart

    Joined:
    Dec 10, 2014
    Posts:
    11
    Hi,
    I'm making a TPS multiplayer with Photon but i'm stuck trying to synchronise all my animations over the network.
    Animations in the Base Layer are corrected synchronized but I've got a throwing animation in a second Layer wich is not.

    Please HELP !
     
  2. Oliver-Eberlei

    Oliver-Eberlei

    Joined:
    Jun 12, 2011
    Posts:
    110
    Hi,

    are you synchronizing the layer weights aswell? I always forget to check if the layer weight on the remote object is set properly and the animation just doesn't play if the weight is 0
     
  3. ManitoBart

    ManitoBart

    Joined:
    Dec 10, 2014
    Posts:
    11
    HI Oliver,
    I'm sorry but I'm nub, How should I do this ? Because I set the second layer to 1 and my problem still the same :
    my animations works but I don't see the throwing animation of an other player in the network.

    Thanks for trying helping me.
     
  4. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    ManitoBart, thanks for the tweet, but sadly I've not used photon enough to be of any real help.

    There are a few dedicated (and official?) threads on the forum by the photon folks. Try to find them and post there is one suggestion. Search for photon in either the search box in the header or google. :-/

    Another is to join the photon forums and ask your photon questions there.

    Sorry I can't be a specific help.
     
  5. willgoldstone

    willgoldstone

    Unity Technologies

    Joined:
    Oct 2, 2006
    Posts:
    792
    I would recommend asking on the Photon forums also, I'm not sure why this would not be sync'd - but in case Olivier is correct, you should check that. If you're not syncing the weights - then you'll never see the animation. Weight defines how much of the above layer's animation is played - if you haven't touched on this or can't check, chances are you'll find other challenges in making a networked multiplayer game.

    See the docs for layer weight here -
    http://docs.unity3d.com/ScriptReference/Animator.SetLayerWeight.html

    and read this too -
    http://docs.unity3d.com/Manual/AnimationLayers.html

    Good luck!

    Will
     
  6. ManitoBart

    ManitoBart

    Joined:
    Dec 10, 2014
    Posts:
    11
  7. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,018
    Thanks Adam and Will!

    In this case, @Oliver Eberlei is "the man".
    He knows this specific feature better than me but is a bit slower to respond (maybe this nag helps).
     
  8. ManitoBart

    ManitoBart

    Joined:
    Dec 10, 2014
    Posts:
    11
    I've got some kind of progress with the new PhotonAnimatorView but it is not working perfectly, my animation is now played half the time.
     
  9. Oliver-Eberlei

    Oliver-Eberlei

    Joined:
    Jun 12, 2011
    Posts:
    110
    It's really tough to give any type of feedback based on the information you provide.

    How are your animators setup?
    What code are you using to trigger the animation? Locally and Remotely?
    Did you check if the layer weights of remote objects are also set to 1? Open the animator view, select a remote object (one that another client controls, not the unity editor) and inspect the layer weights of this object. It shows up in the animatior automatically if you've selected the GameObject with the Animator component attached to it.
     
  10. ManitoBart

    ManitoBart

    Joined:
    Dec 10, 2014
    Posts:
    11
    I found a solution but without photon.

    Thank you anyway !
     
  11. MidgardDev

    MidgardDev

    Joined:
    Dec 11, 2012
    Posts:
    47
    Hi, I don't know why there's no documentation on the PhotonAnimatorView class.

    When is it going to exist?

    Also, could you design the PhotonAnimatorView class to support children Animators instead of having to put a PhotonView and PhotonAnimatorView on the children?
     
  12. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,018
  13. MidgardDev

    MidgardDev

    Joined:
    Dec 11, 2012
    Posts:
    47
    Thanks for the info, yeah I didn't find these pages!

    And I also understand that you can't implement everything, it just seemed like PhotonAnimatorView wasn't yet completed and ready to use ;)

    No problem now. again thank's for the reply.
     
  14. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,018
    Don't get me wrong: I appreciate the input. We never thought about the child animators and we will check this out when Oliver has some time again.
    I just can't promise anything at the moment.
    Thanks for the nice reply :)
     
  15. Oliver-Eberlei

    Oliver-Eberlei

    Joined:
    Jun 12, 2011
    Posts:
    110
    You don't need to add a PhotonAnimatorView AND a PhotonView to the children. Since the new version you can add multiple components to be observed by a single PhotonView. Just add a PhotonAnimatorView to each Animator you want synchronized and add those components to the observed list of the original PhotonView.

    Adding child support to PhotonAnimatorView would make it very complex and difficult to read because in that case the PhotonAnimatorView and the Animator would be on different GameObjects. I feel like having the PhotonAnimatorView on the same GO as the Animator makes it easier to debug in case something goes wrong. It would also be very difficult to keep any references to child animators if you start moving them around in the objects hierarchy. By having them on the same GO this will never be an issue.