Hey guys so i made this code and it works perfectly on my computer, its a scene changer
when i click with my mouse it changes the scene but i dont know how to make it so when i touch my screen on my android the scene changes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadScene : MonoBehaviour
{
public string scene;
private void OnMouseDown()
{
SceneManager.LoadScene(scene);
}
}
If you feel you have an “easy” question, as you mentioned, it’s usually much more efficient for you to just do a google search.
“unity handle screen tap”: Unity - Scripting API: Input.GetTouch
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class LoadScene : MonoBehaviour
{
public string scene;
if (Input.touchCount > 0)
{
SceneManager.LoadScene(scene);
}
}
like this ?
Close but no cigar.
You would need to put the code that checks for the touch inside the Update function (like on the docu page you quoted).