Is this a good way to make a basic random waypoint system?

I started to develop some basic enemy AI and I decided I wanted my character not to have preset points to move to. So I learnt about the Random.insideUnitSphere function and used this to make one Waypoint which to a random point every few seconds. Since the character is always following it, the path always changes. It works well for me, but I just wanted to know whether it will be good when I add stuff like models and animations.

This is my script for moving the Waypoint:-

// Update is called once per frame
void Update () {
	waypointTimer -= Time.deltaTime;
	if(waypointTimer <= 0){
		waypointTimer = 2.0f;
		newWaypointlocation = Random.insideUnitSphere*10;
		Vector3 TP = transform.position;
		TP.x = newWaypointlocation.x;
		newWaypointlocation.y = 0;
		TP.z = newWaypointlocation.z;
		transform.position += newWaypointlocation;


The only problem I can think of is that this may cause the AI to keep walking into obstacles, but otherwise I don’t think it’ll be a problem. It was also not what you asked for and you likely are aware of it.

Your AI probably have some motion controller that tries to steer toward the waypoint and can deal with animation when you have it.

As long as the behavior is what you want, at least for now, it looks good.

Since your AI presumably just walks toward a transform, your method is OK since you can change the behavior of the waypoint node without having to make changes to your AI.