- Home /
Network Animator set trigger not working
Hello everyone,
i have been to almost every forum and question by now and still cannot find a fix for it. I am working on a multiplayer game and the netAnim.setTrigger("Attack1Trigger");
just won't play the animation. I have a Debug.log("Please work");
just above the set trigger so i know that it is 110% reaching that line of code. I have the Network Animator on my enemy and my network components looks like this
The triggers do work if i use GetComponent<Animator>().SetTrigger("Attack1Trigger");
but then it is not synced over the network with other clients. I also tried the SetParameterAutoSend() to make it work but no success there as well.
public override void OnStartServer()
{
for (int i = 0; i < 10; i++)
{
netAnim.SetParameterAutoSend(i, true);
}
}
public override void PreStartClient()
{
for (int i = 0; i < 10; i++)
{
netAnim.SetParameterAutoSend(i, true);
}
}
Could anyone please suggest me a solution to the problem? The netAnim.SetTrigger("Attack1Trigger");
would just not set the trigger and play the animation.
Thanks in advance.
Answer by Abhiroop-Tandon · Apr 04, 2017 at 02:31 AM
Finally after a week of watching all the tutorials and reading all the forums i fixed this, so if anyone faces this problem simply uncheck both the boxes in Network Identity and the NetworkAnimator.SetTrigger(trigger)
starts working.
Please Please Please show me the whole script with NetworkAnimator.SetTrigger(trigger)
only thing i get when i try your solution is:
$$anonymous$$y project "Polygon Nightmare" is totaly stuck at the moment :)
Best regards to you!
@3janeiscool i think you need to use anim.SetTrigger("walk")
since that is the NetworkAnimator object that you have created on line 9
yes. but if i use it. it only play the animation on the client, and it doesn't sync on the other multiplayer clients. :(
thing is i cant find a easy guide discribing the whole process, going from Animator to NetworkAnimator. and get it synced.
Answer by yuantaoHuang · Mar 28, 2018 at 05:49 AM
Do you find that even you use "NetworkAnimator.SetTrigger(trigger)", sometime it still not working. There is still a chance some animation of charactor is not synced. My feeling is I have to use the CMD / PRC method to synced manually.
Yes, for general animations like walking (where ti$$anonymous$$g is not of importance) it is fine but for more time specific animations such as Attack you will need to sync them using the C$$anonymous$$D/RPC method.
Your answer
Follow this Question
Related Questions
Network Animator not working 0 Answers
NetworkAnimator: SetBool vs. SetTrigget? 1 Answer
Play animation from animator? 1 Answer
Animation Starts on begin play 2 Answers
Animation Keypress Trigger Problem 0 Answers