Hello!
Just to be clear i am using Javascript.
I have been working on trying to detect if my mouse has clicked on a specific collider if it is clicked on that specific collider.
heres my code:
var A1L1 : GameObject;
function Update () {
if (Input.GetMouseButtonDown (0)) {
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit:RaycastHit;
if (Physics.Raycast (ray, hit)) {
Debug.Log("HIT SOMETHING!");
if (hit.collider == A1L1) {
Debug.Log("only detected level 1 hit!");
}
}
}
}
My problem is in the “IF statement” that deals with hitting the specific collider, it is not currently accessing the collider on that game object called A1L1, and is NOT returning Debug.Log(“only detected level 1 hit!”); in my console!
Thanks for the help
Daniel