Hi,
until now I check many objects if the were clicked/touched using just one global script:
if (Physics.Raycast (ray, hit, 10000, mask)) {
hit.transform.GetComponent(Clicked).Clicked();
}
This works fine but is a bit unhandy in some cases to me, because:
- I have to attach the Clicked.js to each clickable object.
- I have to use GetComponent(Clicked) in other scripts on this object
I could use OnMouseDown() instead (which is directly accessable in scripts and also works for touches!)
but this impacts performance (yellow console warnings).
What´s your opinion?
Does it still make sense to use Raycast?
Is the OnMouseDown()-impact noticable on lets say 20 objects, especially on iOS?
Thanks!
Carsten