- Home /
One animation breaks playing another
Hi! My characters has auto attack:
void Attack()
{
if (_target != null && IfTargetAlive())
{
if (_targetSelected && _target != null && networkView.isMine && IfTargetAlive() && _target.tag == "Creature" ||
(this.tag != _target.tag && _target.tag.Contains("Player")))
{
if (Vector3.Distance(_target.transform.position, this.transform.position) <= 1.6f &&
Mathf.Abs(Vector3.Angle(transform.forward, this.transform.position - _target.transform.position)) < 270)
{
attackable = true;
if (canAttack)
{
if (Input.GetKey(KeyCode.T))
{
animMainFlag = true;
}
if (animMainFlag)
{
if (!animChoosen)
{
curAnimNum = (int)UnityEngine.Random.Range(0, 3);
animChoosen = true;
}
if (animChoosen)
{
networkView.RPC("AnimNetwork", RPCMode.All, animationAttackList.ElementAt(curAnimNum));
}
}
}
else
{
attackable = false;
}
}
}
}
}
[RPC]
void AnimNetwork(string name)
{
curAnim = name;
if (networkView.isMine)
this.networkView.RPC("SendBool", RPCMode.All, animationAttackList.ElementAt(curAnimNum), true);
}
Characters also have skills, which start with animation:
public void CastSpell(int id)
{
if(IfTargetAlive())
networkView.RPC("SendTrigger", RPCMode.All, "s"+id);
}
When i start attacking (autoAttack mode is ON) should i use spell one moment, spell animation starts playing and it becomes being broken by next attack animation/ So suggest me please how to wait for spell animation ending if it has following structure:
Answer by asecretspot · Jan 09, 2015 at 01:01 AM
I think that is what the "Atomic" toggle is for in the animator. Atomic makes it so the animation should not be interrupted. If you still see the problem after the animation is atomic then the problem would be in the way your animation parameters/states work.
Your answer
Follow this Question
Related Questions
Animation will not Return to Proper State 2 Answers
Mecanim transitions sometimes don't work 4 Answers
Why, when I delete transitions from the Animator State Machine, do I get a null reference exception? 3 Answers
Adding animation transition between idle and walk 1 Answer
Mecanim - How to use "Exit Time" for a state that uses negative speed (anim playing backwards)? 2 Answers