unity how to move character using transform code example

Example 1: transform.Translate movement

using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        // Move the object forward along its z axis 1 unit/second.
        transform.Translate(Vector3.forward * Time.deltaTime);        // Move the object upward in world space 1 unit/second.
        transform.Translate(Vector3.up * Time.deltaTime, Space.World);
    }
}

Example 2: unity how to move character using transform

Using UnityEngine;
Using System.Collections;

public class MovementExample : MonoBehaviour

public float speed = 5f;

void update()
{
  	//2D Top Down
	tranform.Translate(Vector3.up * Time.deltaTime * speed);
  	//3D
  	tranfrom.Translate(Vector3.forward * Time.deltaTime * speed);
}

//The more appropriate way to move in 3D is to use a Character Controller on your GameObject!