How can i sense that an object or prefab(array of prefab) is in range of my Tower. I have a script on tower. Please help, Thanks
Apr 25 '12 at 02:49 PM
Apr 25 '12 at 01:18 PM
Vector3.Distance will be your answer here:
var dist = Vector3.Distance(tower.position, transform.position);
if(dist < range)
Apr 25 '12 at 03:21 PM
Apr 25 '12 at 03:56 PM
edited your answer to add a link to the doc and correct a typo.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
The best place to ask and answer questions about development with Unity. Check out our FAQ for more information.
To help users post good questions and use the site effectively we have posted a tutorial video. Please check it out.
asked: Apr 25 '12 at 02:49 PM
Seen: 331 times
Last Updated: Apr 25 '12 at 03:56 PM
Script so that, my enemies only see my player at a certain range.
Player's projectile communicating with Enemy
help with enemy instantiate script.
Enemy fire script
How can I check the line of sight to see if the player is visible to the enemy?
enemy waypoints and detection scipting
Make enemy Flash when Hit
Trying to get my enemy attack damage to work
On Collide Destroy Game Object
Shoot. Just Shoot