Author Topic: Please Help [RFC]PlayAnimation by Mecanim  (Read 2868 times)

tissueme

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Please Help [RFC]PlayAnimation by Mecanim
« on: December 10, 2014, 08:08:01 AM »
please Help me Thank a lot, I'm newbie in Tasharen Networking


Quote
public Animator anim;
bool runBool;

In Start
Quote
anim = transform.FindChild("Character").GetComponent<Animator>();

And Update
Quote
tno.SendQuickly("PlayAnimation", Target.AllSaved,runBool);

Quote
[RFC]
   void PlayAnimation(bool run) {
      anim.SetBool("idleBool",!run);
      anim.SetBool("runBool",run);
   }



ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Please Help [RFC]PlayAnimation by Mecanim
« Reply #1 on: December 11, 2014, 09:26:16 AM »
Never simply send packets in Update().

Update() can run hundreds of times per second. You can't send that many packets without the network forcing them into batches, lagging everything. You need to send updates periodically -- for example 4 times per second.

In your case you are simply calling a function to play an animation. What's the point of calling it every Update? Simply call it once when it's time to play the animation. Or when something changes -- like run state gets turned on.