Hi, I am making a 2D infinite runner, and I am having this problem on this script:
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace UnityStandardAssets._2D
{
public class Restarter : MonoBehaviour
{
bool CanMove = true;
bool MoveWait=false;
public IEnumerator
void OnCollissionEnter2D(Collision col1){ERROR HERE: Unexpected symbol `void' in class, struct...
if (col1.gameObject.tag == "Enemy") {
GetComponent<Animation> ().Play ("RedGiantDEATHTOALL");
CanMove = false;
if (!MoveWait)
StartCoRoutine (WaitToMove ());
}
}
IEnumerator MoveToWait() {
MoveWait=true;
yield return new WaitForSeconds(1.5f); //Change to Animation Duration
MoveWait=false;
CanMove=true;
}
}
}
I don’t know how to fix it. Can someone help me?
I also don’t know how to make the IEnumerator public.
Thanks for your help!