Ending my game

I’m making a parkour game that when you hit the water the game ends, so I attached this script to the water

using ;UnityEngine;
using ;System.Collections;
 
public class EndOflevel : MonoBehaviour {
 
    void OnTriggerEnter3D(Collider3D)
    {
        Application.Quit();
    }
}

The error “Assets/EndScript.js(4,25):BCE0043: Unexpected token: :.” keeps on popping up everytime I try it.

Seriously? Try deleting the unexpected symbols and see what happens.

Also there is no call back for OnTriggerEnter3D.

Here is the fix

using UnityEngine;
using System.Collections;
 
public class EndOflevel : MonoBehaviour {
 
    void OnTriggerEnter(Collider other)
    {
        Application.Quit();
    }
}

The code you posted is C#.

The error you posted is for JavaScript.

You have C# code in a .js file. If you want to develop in C#, your file extension should be .cs.

The other posters have noticed that your C# syntax was unusual, but fixing that won’t let you compile because Unity’s sending the file to the wrong compiler. Fix your extension and that part of the problem will be fixed.

you have to add the object tag

    using UnityEngine;
    using System.Collections;
     
    public class EndOflevel : MonoBehaviour {
     
    void OnTriggerEnter(Collider3D other)
    {
     if(other.gameobject.tag=="water")
     {
       Application.Quit();
      }

   
    }
    }