Objects that move in Unity? [closed]

-1

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?

    
asked by DSRaptor DEV 28.10.2018 в 18:43
source

1 answer

-1

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);
    }
}
    
answered by 28.10.2018 / 20:28
source