unity change position of gameobject code example
Example 1: how to change the position of a gameobject in c# unity
Vector3 pos = transform.position;
pos.x = 12;
transform.position = pos;
Example 2: move gameobject to position unity
public Transform target;
public float speed;
void Update()
{
float step = speed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position, target.position, step);
}