Answer the question
In order to leave comments, you need to log in
How to move an object in Unity 3D?
How to move an object from its place in a 2D game on Unity 3D. In volume like this:
using UnityEngine;
using System.Collections
public class Example: MonoBehavior {
public GameObject Cube;
void update {
if (Input.GetKey(KeyCode.A)) {
Cube.transform.Translate(-Vector3.right*Time.deltaTime);
}
}
}
Answer the question
In order to leave comments, you need to log in
I would like to clarify what kind of object?
If it’s a sprite, then just like in your example (And there is also Vector3, it’s just that you don’t have to change the Z coordinate)
see what kind of Translate
“types” are
. but then you should describe.
In any case, it was worth describing what kind of object you were going to move)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question