system
1
Is it possible to use a RayCast (idk know what a raycast is) to select an enemy? Like if i have a variable lets say
public Transform EnemySelected;
And i wanted it if you clicked a object that had the script NPC_AI.cs that this variable would equal that enemy? If it is possible how could i go upon doing this?
EDIT:
Sorry i forgot to include this i have a tag also set up if its an enemy
For a good intro video to raycasting, click here
Also, the Unity documentation is your friend.
You can get the transform of an object that was hit with your raycast…
http://unity3d.com/support/documentation/ScriptReference/RaycastHit-transform.html
More information on raycasts can be found here
http://unity3d.com/support/documentation/ScriptReference/Physics.Raycast.html