I have written a simple game in Unity and I need help with some simple AI for enemies.
I have three GameObjects: Background,Player, and Enemy. All these objects have some sprites,rigidBodies etc. and Background contains Box/Circle Colliders. Player can move by pressing W/S/A/D. I need simple script in JS to allow Enemies to follow the Player (with path-finding). I tried something like this, but something has been wrong:
var agent: NavMeshAgent = GetComponent.<NavMeshAgent>(); agent.SetDestination(targetPoint); nothing happens...
Any help please?