system
1
void Wander()
{
wayPoint = new Vector3(Random.insideUnitSphere.x * 8, transform.position.y, Random.insideUnitSphere.z * 8);
timer = timer - 1 * Time.deltaTime;
if (timer <= 0)
{
agent.SetDestination(wayPoint);
timer = Random.Range(4f, 6f);
target.transform.position = wayPoint;
}
}
the fist random is always on a location that isnt in the circle and i dont want always to have the same location
You need to call Random.InitState() at the start of your game.
Use a different value everytime you start the game. For example:
Random.InitState((int)System.DateTime.Now.Ticks);
system
3
is the insideUnitSphere on the object where the script on is