# Mobile input (705848)

**URL:** https://discussions.unity.com/t/mobile-input-705848/705848
**Category:** Mobile
**Tags:** Android
**Created:** [June 22, 2018, 12:51pm UTC](https://discussions.unity.com/t/mobile-input-705848/705848 "2018-06-22T12:51:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![HankaMostowiak](https://avatars.discourse-cdn.com/v4/letter/h/b2d939/32.png) [@HankaMostowiak](https://discussions.unity.com/u/HankaMostowiak)
#### Post date: [June 22, 2018, 12:51pm UTC](https://discussions.unity.com/t/mobile-input-705848/705848/1 "2018-06-22T12:51:32Z")

</div>

How can I change it to work for mobile devices?

```csharp
using UnityEngine;

public class CameraController : MonoBehaviour {

    public float panSpeed = 30f;
    public float panBorderThickness = 10f;

    public float scrollSpeed = 5f;
    public float minY = 10f;
    public float maxY = 80f;

    // Update is called once per frame
    void Update () {

        if (GameManager.GameIsOver)
        {
            this.enabled = false;
            return;
        }

        if (Input.GetKey("w") || Input.mousePosition.y >= Screen.height - panBorderThickness)
        {
            transform.Translate(Vector3.forward * panSpeed * Time.deltaTime, Space.World);
        }
        if (Input.GetKey("s") || Input.mousePosition.y <= panBorderThickness)
        {
            transform.Translate(Vector3.back * panSpeed * Time.deltaTime, Space.World);
        }
        if (Input.GetKey("d") || Input.mousePosition.x >= Screen.width - panBorderThickness)
        {
            transform.Translate(Vector3.right * panSpeed * Time.deltaTime, Space.World);
        }
        if (Input.GetKey("a") || Input.mousePosition.x <= panBorderThickness)
        {
            transform.Translate(Vector3.left * panSpeed * Time.deltaTime, Space.World);
        }

    }
}

```

---

<div class="post-metadata">

### Author: ![JuliusM](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@JuliusM](https://discussions.unity.com/u/JuliusM)
#### Post date: [June 27, 2018, 8:59am UTC](https://discussions.unity.com/t/mobile-input-705848/705848/2 "2018-06-27T08:59:03Z")

</div>

On mobile devices you can use accelerometer or touch input for that. Take a look at this manual page [Unity - Manual: Mobile device input](https://docs.unity3d.com/Manual/MobileInput.html)
