Hello Guys,
For my Game i need an script that is playing 2 Animation alternately.
So lets say i have a Cube that reaches one side of my Map with animation 1 i want that it moves back with animation 2.
Maybe someone can help me because i cant “write” good C# Scripts
I only need C# Scripts please. Thanks for your Help
Hi,
Here is an easy take to it.
using UnityEngine;
using System.Collections;
public class AnimationChanger : MonoBehaviour {
private Animation currentlyPlaying;
public Animation animationOne;
public Animation animationTwo;
void Start () {
currentlyPlaying = animationOne;
}
void Update () {
if(!currentlyPlaying.isPlaying currentlyPlaying == animationOne)
{
animationTwo.Play();
currentlyPlaying = animationTwo;
}
else if(!currentlyPlaying.isPlaying currentlyPlaying == animationTwo)
{
animationOne.Play();
currentlyPlaying = animationOne;
}
}
}