- Home /
Touch event triggers Input Setting
I have a game where the jump is triggered by the "o" on the keyboard (using the Input Settings). I'm making a version for mobile and created a GUI button. I don't know how to translate the touch event to being the same as pressing the "o" key in the Input Settings! Like forcing a specific key press when there is no keyboard.
Thank you for helping me fill in this blank:
void On_ButtonUp (string buttonName)
{
//code for pressing the "o" button??
}
Answer by cj12345 · Feb 05, 2014 at 05:16 PM
var jumpButtom : GUITexture;
function Update(){
for (var evt : Touch in Input.touches) {
var HitTest1 = jumpButton.HitTest(evt.position);
if (evt.phase == TouchPhase.Began) {
if(HitTest1){
This will repair your computer input. Just add this on input section and drag GUI TEXTURE to jumpButton. Just a gui texture nothing more :)
What do you mean by "add this on input section"?
I made a GUItexture, added the script and dragged the object to the Jump Button variable in the inspector. Is this what I do to make it work?
Thanks for your quick help!
Your answer
Follow this Question
Related Questions
How to make a Key Listener in unity 1 Answer
GUI texture touch to input 1 Answer
Key remapping inGame 0 Answers
EventSystem not detecting all UI elements 1 Answer
Rotate object after swipe according to swipe direction 0 Answers