Make a character walk around randomly

I have want to make a game object move around randomly, like a person. I do not need information on how to animate the character (run, walk, jump) but i just want it to walk around the map aimlessly.

**ps i just want s script that i can copy and past directly into monddevelope without any complier errors Thanks

I did that once, where the character simply chooses a direction, then moves a few seconds in that direction. Then chooses another direction, and so on.

You can tweak this as much as you want, so add a random element to the amount of time he walks in each direction.

Sample code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class NPCController : MonoBehaviour {
    private float timeToChangeDirection;

    // Use this for initialization
	public void Start () {
	// Update is called once per frame
	public void Update () {
		timeToChangeDirection -= Time.deltaTime;

        if (timeToChangeDirection <= 0) {

		rigidbody.velocity = transform.up * 2;

    private void ChangeDirection() {
        float angle = Random.Range(0f, 360f);
        Quaternion quat = Quaternion.AngleAxis(angle, Vector3.forward);
        Vector3 newUp = quat * Vector3.up;
        newUp.z = 0;
		transform.up = newUp;
		timeToChangeDirection = 1.5f;

This should be what your asking for.