how do I attach a player with a navMeshAgent
public var player : Transform; function Awake () { player = GameObject.FindGameObjectWithTag ("Player").transform; nav = GetComponent (UnityEngine.AI.NavMeshAgent); } function Update() { var distance = Vector3.Distance(player.position, transform.position); if(distance <= 30) { nav.enabled = true; nav.SetDestination (player.position); } else { this.nav.enabled = false; } }
Also in C#:
- singleton unity
- error CS0542
- string to uint c#
- unity rb.addexplosionforce 2d
- how to reload app.config file at runtime in c#
- weakreference tryget c#
- c# to binary
- how to set progress openedge driver name for odbc connection c#
- open new window c# wpf
- how to switch scenes in unity
- unity get max occurrence in list
- query associative table ef6
- how to insert <input> datatype <td> in asp.net core table
- c# two dimensional array
- play animation through script unity
- parsing string to int c#
- No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.'
- get normal from 3 points
- out parameters c#
- c sharp list indexer
- change text color wpf
- c# AllowSynchronousIO to true
- Assets\playermove.cs(30,37): error CS1003: Syntax error, ',' expected
- unity fps counter