Parser error in death code

Hi im working on a death code and theres a parser error with void in line 14 heres my code:

using UnityEngine;
using System.Collections;

public class Death : MonoBehaviour {

    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {
   
        void OnTriggerEnter2D(Collider2D other) {
            if(other.tag = "Player")
            {
           
            {
                // Player entered red zone, reload game.
                Application.LoadLevel(0);
            }
        }
    }

Thanks in advance!

You cannot put a method inside another method. (Here “OnTriggerEnter2D()” is inside “Update()”.)

Oh i see.

now it just says parsing error ill try to figure this out by myself

Im trying to figure this one out but im gonna need more help its says parsing error

using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {

    // Use this for initialization
    void Start () {
   
    }
       
        void OnTriggerEnter2D(Collider2D other) {
            if(other.tag = "Player")
            {
               
                {
                    // Player entered red zone, reload game.
                    Application.LoadLevel(0);
                }
            }

Hint: Always keep the placement of braces and indentation of lines consistent.

real awnser please

Like I’ve said: Correct your indentation and braces, and you may spot and extra or missing one.

Should look like this:

public class Example : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {

    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {

            {
                // Player entered red zone, reload game.
                MediaTypeNames.Application.LoadLevel(0);
            }
        }
    }
}

Hi !

I really like the brackets begin and end in the same column ,
that way I always see what is missing .

An initial reading