move object using transform.position in x axis code example
Example 1: unity set position
// To set the position of a gameobject use the following
GameObject.transform.position = new Vector3(x, y, z);
Example 2: hot to move pobject unity
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);
}
}