Sorry to bother you but i’ve a problem with my code, i don’t know how to use properly the command waitforsecond. my code look like that:
using UnityEngine;
using System.Collections;
public class animation : MonoBehaviour {
public GameObject Soldier_0;
public Animator Player;
private int dep1;
private int dep2;
private int up1;
private int up2;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
dep1 = transform.position.x;
up1 = transform.position.y;
yield return new WaitForSeconds(0.04);
dep2 = transform.position.x;
up2 = transform.position.y;
if (dep1 > dep2)
{
Player.SetBool(“Run”, true);
Soldier_0.transform.localScale = new Vector3(-1, 1, 1);
Soldier_0.transform.rotation = new Quaternion(0, 0, 0, 0);
}
if (dep1 < dep2)
{
Player.SetBool(“Run”, true);
Soldier_0.transform.localScale = new Vector3(1, 1, 1);
Soldier_0.transform.rotation = new Quaternion(0, 0, 0, 0);
}
if ((dep1 = dep2) && (up1 = up2))
{
Player.SetBool(“Run”, false);
}
}
}
and the error code is :
Assets/script/animation.cs(19,14): error CS1624: The body of animation.Update()' cannot be an iterator block because
void’ is not an iterator interface type
thanks in advence for your reply