public float animationSpeed;
public MeshFilter meshFilter;
public Mesh[] meshSequence;
int curFrame;
float frameLength;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(frameLength >= animationSpeed)
{
UpdateAnimationFrame();
frameLength = 0;
}
else
{
frameLength += Time.deltaTime;
}
}
void UpdateAnimationFrame()
{
curFrame++;
if (curFrame > meshSequence.Length - 1) curFrame = 0;
meshFilter.mesh = meshSequence[curFrame];
}