Unity Breakout Game

Im trying to do the simplest of things yet it doesn’t even work. I am extremely new to c#. I am meant to have a ball bounced into bricks and make the brick be destroyed.

using UnityEngine;
using System.Collections;

public class Block_Destroy : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

void OnColliderHit(Collider Collision)
{
if(collision.gameObject.tag == “Block”)
{
print(“It works”)
}
}
}
}

I don’t know what OnColliderHit is, (may be real I don’t know).

But the way I’d do it is

void OnCollisionEnter(Collision col){

if(col.gameObject.tag == “Block”){

debub.Log(“It Works”);

}

}

Please use code tags.

The first issue you have is that you have a method definition inside another method definition.

using UnityEngine;
using System.Collections;

public class Block_Destroy : MonoBehaviour {

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
}

void OnColliderHit(Collider Collision)
{
if(collision.gameObject.tag == "Block")
{
print("It works")
}//end if
}//close OnColl..

}//close class