How to engage an object if it's seen by my camera??

Here’s the code, however i’d like to engage an object that is seen by my camera

for (var width = 1; Screen.width; width++){
	 		 for (var height = 1; Screen.height; height++){
	 		     var ray = Camera.main.ScreenPointToRay (Vector3(width, height, 0));
	 		     var hit : RaycastHit;
	 		 	 if (Physics.Raycast(ray, hit, Mathf.Infinity ) && hit.transform.tag == tagLock){
	 		 	 	Debug.Log("finalmente!!");
	 		 	 }
	 		 } 
	 	
	 	}

Hmmm… it took me a while to figure out what you are trying to achieve with your code… in theory that’s probably possible… but seems quite cumbersome. I think here you’ll find some more elegant approaches for your problem…? How can I know if a gameObject is 'seen' by a particular camera? - Questions & Answers - Unity Discussions

Or am I missing the point of your question?

Greetz, Ky.