I would like to make a square that moves in Unity, but I do not know how to do it, I search and I can not find it, could you explain how?
I would like to make a square that moves in Unity, but I do not know how to do it, I search and I can not find it, could you explain how?
You should keep an eye on the translate method of your transform component.
You can access this from the update of your script:
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);
}
}