The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Animator view and triggers

Carme
2019-01-06 20:04:05

Hi,

I have unity 2018.3 with the latest pun 1.92. I'm unable to get triggers working with the animator view.

I've read everything I can, so to confirm:

-Animator view is the last script in the prefab stack, and the last in the photon view option list - I've deleted and recreated it several times to ensure its definitely last in the stack and photon view.
-I use continuous.
-(One thing I noticed was the culling script adds itself automatically to the photon view list, even if its there already.. I tested by removing the culling script completely but the animations still do not work with the culling script active or deleted so its not this that is stopping animations - thought I'd mention that though..)

I never see the trigger change from false to true in the inspector view, and running with two players, the second player never sees the animations.

Is there a demo on this so i can check everything matches or some other trick to getting this working?

Is there a way to get it working via the OnPhotonSerializeView script ? i.e. the stream.sendnext and receive.next ? - I tried but could not work it out.

and no I really don't want to go through 100+ animation states and change them all to bools, almost all assets and creators are using triggers these days - the coding headache would be insane - surely you photon guys have a solution.
I see you struggling for a few years now with this issue and I do appreciate the single frame thing, but is there nothing that can be done ? :)

Kind Regards

Carme

Comments

Carme
2019-01-07 20:13:49

ah nvm. Work around with ints I can sync easily without changing triggers to bools in the animator itself.

With user input like (space bar for jump) I set an int to a number corresponding to the the animation, I then use OnPhotonSerializeView script to check if the int > 0 if so, then map the corresponding animation, run the trigger and set the int back to 0.

In the:
public int Photnet_AnimationSync = 0;
Animator anim;

in start :
anim = GetComponent();

if (stream.isWriting)
{
if (Photnet_AnimationSync > 0)
{
stream.SendNext(Photnet_AnimationSync);
Photnet_AnimationSync = 0;
}
}else
{
Photnet_AnimationSync = (int)stream.ReceiveNext();

}

Photnet_AnimationSync gets the int number from whatever your animation script is.

Seems to work, I thought the photon animator view was to good to be true :) -still half a solution.

Funesto
2019-01-08 21:14:23

Hello! I am having the same issue, I think. I just opened a thread as I did not noticed yours. Please could you explain how to use that OnPhotonSerializeView? I'd like to learn how to see all the animation in a multiplayer scene!

kureysalp
2019-08-31 02:04:38

Hi!

"Photnet_AnimationSync = (int)stream.ReceiveNext();" must give you "InvalidCastException: Specified cast is not valid" because you are only sending value when it changes but you are receiving it every serialize. How did you handle it withouth sending Photnet_AnimationSync when it doesn't change?

Back to top