Trigger play
Options
hello, i want my script just to activate once and sync for everybody.
what i mean is that when a player triggers an animation (helicopter going by it self) it should be synced for other people too.
and when a player joins the animation must not restart in their vision.
heres the script:
what i mean is that when a player triggers an animation (helicopter going by it self) it should be synced for other people too.
and when a player joins the animation must not restart in their vision.
heres the script:
using UnityEngine; public class helicoptertrigger : MonoBehaviour { public Animator animator; void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { animator.SetTrigger("helicopter"); } } }
0
Best Answer
-
Hi, I had a problem with triggers too. It seems that triggers don't work properly and sometimes they are sent and sometimes not. Just use boolean instead. It can work similarly, just set bool to TRUE when you want to animation to play and set up an animation in Unity event - > where you can disable this boolean and send it using RPC calls. It's little workaround that I'm using and it works.5
Answers
-
if anybody knows can somebody tell me how to do it?0
-
Also another question, how can i make so that when an animation is played (lets just say an airplane going back and forward by it self) just to have the exact same animation time, so like if a player is in that airplane players dont see him just flying and an airplane in front of him or backwards but i want them to see that hes in an airplane0
-
Should i put photonview?0
-
and yes im trying to do something like the helicopter in zombie escape from counter strike 1.60
-
beep boop, help?? im stuck here forever0
-
How about you read and code-along some tutorials? And or read the docs while you patiently wait for someone to help?
0 -
How about you read and code-along some tutorials? And or read the docs while you patiently wait for someone to help?
Yes i did read but i dont understand the syncing for an animation that is not a player but is a object (yes 2 animators here, lava rising up and helicopter, lava by it self moves no triggers forgot to say that)0 -
Federico123 wrote: »How about you read and code-along some tutorials? And or read the docs while you patiently wait for someone to help?
Yes i did read but i dont understand the syncing for an animation that is not a player but is a object (yes 2 animators here, lava rising up and helicopter, lava by it self moves no triggers forgot to say that)
Cause when me and my friend play, he goes to the helicopter, in his visual the helicopter is flying and hes inside, but in my visual i see him flying and the helicopter is still down, same with lava, for him its really close to him but for me its not and its still rising up0 -
Anyone reading this, i have made a new discussion i explain everything clearly, i also edited the code but i still have a sync problem, if a mod sees this, they can close this down, heres the new discussion: https://forum.photonengine.com/discussion/15769/sync-problem/p1?new=10
-
Hi, I had a problem with triggers too. It seems that triggers don't work properly and sometimes they are sent and sometimes not. Just use boolean instead. It can work similarly, just set bool to TRUE when you want to animation to play and set up an animation in Unity event - > where you can disable this boolean and send it using RPC calls. It's little workaround that I'm using and it works.5