Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: tissueme on December 10, 2014, 08:08:01 AM

Title: Please Help [RFC]PlayAnimation by Mecanim
Post by: tissueme 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);
   }


Title: Re: Please Help [RFC]PlayAnimation by Mecanim
Post by: ArenMook 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.