Hi guys, I have this code:
function checkForButtons()
{
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 200))
{
var objecthit:Transform = hit.transform as Transform;
if (hit.collider.name == "button_start")
{
print ("object clicked!");
}
}
}
Plain and simple way to detect a touch on an object, the problem here is that I have multiple objects with different names (or tags) that need to detect the touches, how can I
use this code without re writtting it for every single object?