My Code Isn't Working

What I am trying to do is time a level to play until the timer ends, then it’s going to go to the real level.

It isn’t working.

What am I doing wrong?

(I am getting errors like, "You need either ), ', “, =,” and one other error.)

using UnityEngine;
using System.Collections;

public class LoadLevelREAL : MonoBehaviour 
{
	public string Level1;
	
	public void OnTriggerEnter2D (Collider2D other) 
	{
		if (other.tag == "Player") 
		{
			StartCoroutine("MyMethod");
			Application.LoadLevel (4);
		}

		IEnumerator MyMethod() 
		{
			yield return new WaitForSeconds(5);
			Application.LoadLevel(0);
			yield return null;
		}
	}
}

you have an enumerator inside your OnTriggerEnter2D function, move it to its own function like this

public void OnTriggerEnter2D (){
… blah blah blah
start coroutine
}

IEnumerator MyMethod (){
… blah blah blah
}

You have put a named method inside another method. It’s not allowed.

 public void OnTriggerEnter2D (Collider2D other) 
 {
     /* Ignore code */
     IEnumerator MyMethod()  // Whee, a non-anonymous method inside a method!
     {
         /* Ignore code */
     }
 }

Move MyMethod out of OnTriggerEnter2D, so it becomes a member of the class.

 public void OnTriggerEnter2D (Collider2D other) 
 {
     /* Ignore code */
 }
 
 IEnumerator MyMethod() 
 {
     /* Ignore code */
 }