How to detect touch on a 3DText and perform an action for example load another scene.
Anyone?
You could add a button onto the 3D text,
then in a script have
public void buttonPress()
{
SceneManager.LoadScene("SceneName"); // put name of scene here.
}
Then drag the script onto a gameobject such as “Main”
then in the button heirarchy set the OnClick to the script
Shown in the image
this will load the scene, when you touch/click the button
Are you sure this will work for “touch”?
Well im getting this error:
The name `SceneManager’ does not exist in the current context
did you import it?
using UnityEngine.SceneManagement;
If you are not using a GUI, you can always add it to any gameobject that has a trigger collider on it as well using OnMouseUp:
using UnityEngine;
using UnityEngine.SceneManagement;
public class Test : MonoBehaviour {
void OnMouseUp(){
print("Clicked!");
SceneManager.LoadScene("SceneName");
}
}