The below is just theory and how I would go about trying to accomplish this using the built in 4.6 UI.
Step 1. In whatever script handles your input, instead of the code where you detect input (Skimming through your code I believe this is an example of handling the jump button)
if (CrossPlatformInput.GetButtonDown("Jump")) jump = true;
You would want to create a bool for each input. So instead of "if(the jump button input is held down)" you want if(myNewJumpBool == true). Leave the contents of the if statement the same.
Step 2. Using the GameObject->UI menu, add a button to your scene.
Step 3. Create a simple class (call it something like "JumpButton" that has a a public reference to the script you modified before. Give the class two functions. One that sets the bool to true. One that sets the bool to false. Drag this new class on your button in the inspector.
Step 4. In your scene, click your button and hit the AddComponent button. Find "EventTrigger". Add an Event Trigger and press the Add New button. You're going to want to add a "PointerDown" and a "PointerUp". The PointerDown should refer to the script that sets the bool to true, and the PointerUp should refer to the script that sets the bool to false.
That should basically work for a simple implementation of what you're looking for.
↧