animator trigger not synchronizing

So I have an attack trigger and it is not synchronizing properly with the animator view,
i made sure the "set trigger" script is before the animator view and i should work but it doesn't...
i tried to search the forum for solution but couldn't find one.

thanks is advance for the help

Comments

  • anyone? please?
  • Hi @yosi1202,

    Thank you for choosing Photon!

    I assume you read the documentation page here.
    Also check out other discussions in the forum by using search feature e.g. query: "animator trigger".
    I think this post for instance could be useful.

    What PUN version do you use?
  • @JohnTube Thanks for the reply

    yes i read the documentation.
    yes i searched the forum.
    yes i read this post.

    non solved it...
  • Hi,

    Can you make a screenshot showing your inspector stack of components and how they are setup?

    - where do you actually set the trigger in your code? the component where you set the trigger must be before the proxy, can you confirm this?


    Bye,

    Jean
  • @jeanfabre

    I am setting the trigger in the "MagePlayerPvp" script, in "UpdateMove()" function witch is called in the "Update()" function,

    the code:

    if (Input.GetMouseButtonDown (0) && stamina >= 10)
    {
    attackTimeTemp = Time.time;
    animator.SetTrigger ("attack 0");
    }

    the inspector:



    and yes i tried to copy the animator view removing and pasting it again...
  • Hi,

    I am having trouble also here, so let me try to find a way around this, I'll get back to you when I have something working.

    you can do one thing if you are in a rush. swap your triggers with regular boolean parameters. then it persist for at least one frame, because you have to manually raise your bool parameter to true and to false the next frame, this way it works.

    the problem, so you understand is that when you raise a trigger, Mecanim doesn't keep the parameter value to true for a whole frame, it's only in a portion of the frame, and likely not even till the end of a frame, hence why we struggly to catch it. in Unity 4 I found a way, and it was working for awhile in previous version of Unity 5, but with 5.6 it seems it's getting more difficult to get it working. I managed few times, by redoing the prefab so that the order, but I haven't found a definitice guide on how to make it work 100% every time you build such prefab.

    Bye,

    Jean
  • yosi1202yosi1202
    edited June 21
    dammit i know i shouldn't have upgraded to unity 5.6 :(
    It will really help me if you could find a solution within the next 1-2 weeks...
    please let me know if you find a solution
  • edited June 23
    I'm having a problem replicating a Trigger in 5.5.2f1. Photon Animator View is at the bottom. What's weird is my Die trigger works fine but the Respawn is never triggered on others.

    https://hastebin.com/nixisegoqu.cpp

    Some additional info from more testing:
    I flagged the Death and Respawn triggers over and over very fast on my editor and the other client saw all of the changes in the animator no problem.
    For some reason it's only when using RPCs that it is somehow causing issues.
  • @jeanfabre is there any solution yet?
  • Hi,

    - @yosi1202 a short term solution is to use Boolean parameters instead triggers, unfortunatly, I haven't found a definite solution for this issue.

    - @Majicpanda your code only shows where the parameters are set, not when, the key to this issue if when during the life time of a frame, the trigger is raised, and wether the PhotonViewAnimatorProxy will be checking during the time that trigger is true, because the animator likely set it back to false instantly, so the trigger value is not kept to true long enough for all scripts to get a chance to catch it .

    I am thinking of reporting a bug to Unity, but I don't think they will change Mecanim behavior for this, the other solution would be to create a dedicated api method that you use to raise a trigger, so that we record the rasied trigger and we set the mecanim trigger, a sort of composition where you let us deal with this so that we become aware of it without having to monitor for what could have possibly changed.

    Would that be suitable for you? it unfortunatly means it won't be a turn key solution as code as to be edited to become fully compatible with Photon, but at least it would work.

    Bye,

    Jean
  • thanks for your answer, for now i will just use boolean parameters
  • edited June 30
    I have switched to RPCs for all Triggers that are hard transitions like Respawn/Death and simply call the trigger locally. This requires creating your Mecanim char controller in a way that can't get out of sorts (proper usage of the "Any State" state), but it works so far.

    I can't tell how it would work in the real world, but off the top of my head if you made an API call would it not simply be an RPC? Are all RPCs syncd at the same rate of the network send rate (20hz) default, and if so what order do they come in compared to the PhotonAnimatorView?

    I'd love to test something, but I can't really say if it would be better or worse than simply calling RPCs for every Trigger. Am I adding "Messages per second" by using RPCs vs them all being collected in the PhotonAnimatorView? That would be a big problem since I'm already working on the area influence optimizations to get 12v12 in a game.
  • @jeanfabre now for some reason non of my animator parameters are synchronized, if i look in the inspector it looks like the values are changes in the animator view but in the player animator itself nothing change (not only for triggers but integers floats and bools too), i did change anything that is related to the animator view...
  • Hi,

    using RPC for triggers might be a way, but the problem here is different, it's about catching that somewhere in code the trigger was raised, and how to catch it in another script.

    this is the bottom of the problem, not photon, or how to synch the value, the problem is how to get the value in the first place.

    you can actually experiment yourself, make a component that log a debug in the console everytime a trigger value is true, by querying the animator.

    Bye,

    Jean
Sign In or Register to comment.