TOUCH CONTROLS in Unity!

Brackeys · 1.4M views · 2018 · 16:09

Open on YouTube

Indie game developmentGame programming & enginestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking about mobile touch input and on-screen joysticks in Unity.

Recommended by 2 people across 2 different months, 2020 to 2022.

What it is

A Brackeys tutorial on adding touch controls to a Unity game, including reading finger input and setting up an on-screen joystick for mobile play. It walks through the setup step by step in the Unity editor and testing with Unity Remote.

What people said

Recommends Jadon Wolfgang · 2020-10 · Stack Overflow · on “How To Move 3D Object By touch Dragging The Finger On the screen”

The easiest thing to do would be to set the position of the players finger on the screen to a worldpoint and set that world point to a Vector3. the move the ball to the worldpoint Vector3 (asuming you want to use a speed to move with, else just use .position). //Variables public transform ball; public float speed = 10f; //i do not know about touch screen controls. this is something i will link to below! //Get Touch Position Vector3 worldTouchPos = screenTouchPos; //worldTouchPos = the touch position in world space, and the screenTouchPos is the touch position on the screen ( so a value between 0 and 1 in both x and y). //Ball Movement ball.position = Vector3.MoveTowards(ball.position //pos t

Recommends Mehmet Bütün · 2022-01 · Stack Overflow · on “Unity Buttons making do letters”

Using different button is related to your game design. However, if you are developing this kind of game, it may be difficult for the user to use these buttons with the joystick. It may be a good option if the vehicle moves automatically. You can watch this tutorial for develop your own joystick: [this video]

Cites JonathanXD12 · 2021-05 · Stack Overflow · on “Why do I get this error for a joystick in Unity?”

I'm currently making a 2D game as a beginner and I wanted to add joystick controls to my game. I made everything like in the youtube video of Brackeys, but I always get this error: NullReferenceException: Object reference not set to an instance of an object PlayerMovement.Update () (at Assets/Scripts/PlayerMovement.cs:21) Could anyone help me pls? The link to the youtube video and timestamp is: [this video] my current script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public CharacterController2D controller; public Animator animator; public Joystick joystick; public float runSpeed = 40f; float horizontalMove = 0f; b