Dropdown On-screen menu for FPS positions on mobile device.
Hi I need to reposition the player in different locations around my scene according to a selected location. I have managed to do this with KeyCodes but need to do this on a mobile device. I am using standard DualTouchControls but when adding a Dropdown or even just a Button i can't associate my code to the button. I have researched touch screen strategies but think they are too complex for what i need. To test this i'm trying to just make a simple "Back to Main" Menu Scene Button but having the same issue. I'm stumped and would appreciate if anyone could push me in the right direction. Cheers K. This is the code i am using to locate my player which works perfectly in Windows. Below i have added the Java Script i am using for the Return to Main button.
using UnityEngine; using System.Collections; public class TeleportFP : MonoBehaviour { private GameObject Position1; private GameObject Position2; private GameObject Position3;
private void Start ()
{
Position1 = GameObject.Find ("Position1");
Position2 = GameObject.Find ("Position2");
Position3 = GameObject.Find ("Position3");
}
private void Update()
{
if (Input.GetKey(KeyCode.A))
{
transform.position = Position1.transform.position;
}
if (Input.GetKey(KeyCode.B))
{
transform.position = Position2.transform.position;
}
if (Input.GetKey(KeyCode.C))
{
transform.position = Position3.transform.position;
}
}
}
// Java Script for Returning to Main Menu function ReturnButton () { Application.LoadLevel(0); }