Синтаксис:
Используется csharp
public GameObject obj;
public float range = 5f;
void Update()
{
float h = Input.GetAxis("Horizontal");
float xPos = h * range;
obj.transform.position = new Vector2(xPos, 0);
}
public float range = 5f;
void Update()
{
float h = Input.GetAxis("Horizontal");
float xPos = h * range;
obj.transform.position = new Vector2(xPos, 0);
}