- Home /
replace Input.GetKey for mobile input
Hi,
im new with unity, i just bought a complete project FPS games for PC and i want to convert it to mobile device. the process look like this, when i touch a button (2d toolkit), it will then send "something" to the script. i will then replace the Input.GetKey in the script with "something"
what is "something" called? is it variable? or function? or method?
how do i send this event to this script. sorry im really new to programming.
void Update (){
// Make sure the user pressed the mouse down
if(!Input.GetKey(KeyCode.Z)){
return;
}
Answer by DaveA · Apr 16, 2013 at 04:52 AM
You may want to use the GUI system to make a Button which would trigger whatever behaviour you want. Or you can put an OnMouseDown on an object and use that as the trigger. Or you can use the Input.touches stuff to look for touch information. So many options! Up to you how you want to interact with the app.
Hi, thanks for your quick reply. I have considered all your options before. But what im looking is to replace the input.getkey with a custom method. This is because im using playmaker for the scripting and i think it will be easier if i call the method from playmaker.
Could you write me an example script that replace the input.getkey with a method?