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()
{
transform.Translate(Vector3.forward * Time.deltaTime);
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()
{
tranform.Translate(Vector3.up * Time.deltaTime * speed);
tranfrom.Translate(Vector3.forward * Time.deltaTime * speed);
}