---
title: "GetAxis"
content_type: tutorial
url: "https://learn.unity.com/tutorial/getaxis-e?language=es"
language: es
difficulty: beginner
duration_minutes: 5
unity_version:
  - "4.x"
supported_unity_versions:
  - name: "4.x"
    url: "https://learn.unity.com/tutorial/getaxis-e.md?language=es&version=4.x"
available_languages:
  - name: "en"
    url: "https://learn.unity.com/tutorial/getaxis-o.md?language=en"
  - name: "es"
    url: "https://learn.unity.com/tutorial/getaxis-e.md?language=es"
  - name: "ja"
    url: "https://learn.unity.com/tutorial/getaxis-guan-shu.md?language=ja"
  - name: "ko"
    url: "https://learn.unity.com/tutorial/getaxis-d.md?language=ko"
  - name: "zh-cn"
    url: "https://learn.unity.com/tutorial/getaxis-o-1.md?language=zh-cn"
last_updated: "2026-08-04T14:23:50.000Z"
---

# GetAxis

Aprende a usar GetAxis para leer entradas basadas en ejes y a configurarlas en el Input Manager de Unity.

Cómo se puede obtener el valor de los ejes o GetAxis basado en las entradas del jugador de tus juegos en Unity y cómo se modifican los ejes en el administrador de ingresos o Input Manager.

Este tutorial está incluido en el proyecto [_Scripting_ para principiantes. ](https://learn.unity.com/project/scripting-para-principiantes)

Previo: GetButton y GetKey

Siguiente:  OnMouseDown

## 1. GetAxis

[Video](http://www.youtube.com/watch?v=MK4OmsViqMA)

## **AxisExample**

```csharp
using UnityEngine;
using System.Collections;

public class AxisExample : MonoBehaviour
{
    public float range;
    public GUIText textOutput;
    
    
    void Update () 
    {
        float h = Input.GetAxis("Horizontal");
        float xPos = h * range;
        
        transform.position = new Vector3(xPos, 2f, 0);
        textOutput.text = "Value Returned: "+h.ToString("F2");  
    }
}
```

## **AxisRawExample**

```csharp
using UnityEngine;
using System.Collections;

public class AxisRawExample : MonoBehaviour
{
    public float range;
    public GUIText textOutput;
    
    
    void Update () 
    {
        float h = Input.GetAxisRaw("Horizontal");
        float xPos = h * range;
        
        transform.position = new Vector3(xPos, 2f, 0);
        textOutput.text = "Value Returned: "+h.ToString("F2");  
    }
}
```

## **DualAxisExample**

```csharp
using UnityEngine;
using System.Collections;

public class DualAxisExample : MonoBehaviour 
{
    public float range;
    public GUIText textOutput;
    
    
    void Update () 
    {
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");
        float xPos = h * range;
        float yPos = v * range;
        
        transform.position = new Vector3(xPos, yPos, 0);
        textOutput.text = "Horizontal Value Returned: "+h.ToString("F2")+"\nVertical Value Returned: "+v.ToString("F2");    
    }
}
```
