-
-
Notifications
You must be signed in to change notification settings - Fork 18
instance_nearest
CryoEagle edited this page Jan 5, 2019
·
1 revision
Return nearest GameObject
instance_furthest(position, obj, countMe)
Argument | Description |
---|---|
Vector2 position |
Position from to start comparing distance |
Type obj |
Object for comparing |
bool countMe |
bool for counting this object too |
Returns: GameObject
This function will find nearest object from given position, this code is usefull when programming basic game AI, AI will find nearest GameObject then move there and destroy that object.
GameObject nearestObj = instance_nearest(Position, typeof(oObjectToFind), false);
This code will find nearest object named oObjectToFind
and save it to local variable GameObject
nearestObj.
Back to Instances