expecting (, found 'OnCollisionEnter'. (BCE0044) Error

Hi people, I’m rather new to Unity and programing. While finishing up a tutorial I decided to mix things up and try something out but I get 3 errors on this code chunk.

  1. Expecting(,found ‘OnCollisionEnter’

  2. Unexpected token:col.

  3. Expecting }, found". (at the end of the code chunk)

I would be grateful for any help I can get.

function Start () {
    
    }
    
    function Update () {
    
    function OnCollisionEnter (col:Collision);
    {
         if (col.gameObject.tag == "Brick")
         {
              audio.PlayOneShot(bricksound,0.5);
              Destroy (col.gameObject);
              
              if (Gamecontroller.score >=0)
              {
                 Gamecontroller.score = Gamecontroller.score + 10;
              }
         }
         }

Delete the line function Update () {

You need to close the braces at the end of your function.


    function Start () {
     
    }
     
    function Update () {
    }
     
    function OnCollisionEnter (col:Collision) {
	    if (col.gameObject.tag == "Brick") {
		    audio.PlayOneShot(bricksound,0.5);
		    Destroy (col.gameObject);
		    if (Gamecontroller.score >=0) {
		   		Gamecontroller.score = Gamecontroller.score + 10;
		    }
	    }
    }