Hey guys I am porting a game onto iOS for Ipad. I have been sifting through the Unity API iOS section and really cant seem to find examples of how to do basic touch inputs. I have a game that uses basic WASD and Mouse 1 and Mouse 2 inputs for moving a character around, it is for mac/pc and want to convert these controls over to iPad. I am talking about examples of tapping to play an animation, or holding and sliding to make a character play a walk animation and move, swipe upwards to make the character jump etc. Anybody know of some good tutorials that cover these basics? Javascript
http://wiki.unity3d.com/index.php?title=Basic_iOs_Input_Tutorial
This has helped me loads!!
Thanks for that link! I am a little confused, because the example if statement shows Input.GetButton(“Fire1”) and then do TapFunction(). And it doesn’t show any specific iOS code in the TapFunction(). I don’t get how that works exactly, because Input.GetButton is just basic Unity input?
function Update() {
if(Input.GetButton("Fire1")) {
TapFunction();
}
}
function TapFunction() {
//Respond to tap event
//Note that "TapFunction" can be called anything you like.
//You could also omit TapFunction(), and just respond inside of Update(). But putting the response in a function is usually the way to go.
}
It is calling what the input would activate. In that case fire1 which can be set to any key inside unity settings. I’m not sure because I don’t have a Mac but I think tap function should be a programmable " button" then unity knows that a single screen tap = fire1
I didn’t phrase my question correctly, sorry. I meant is TapFunction() a function that I need to program or is that a predefined unity function? Because it looks like I would have to write it myself, in which case, I don’t know what iOS specific classes/functions to use. I looked up Touches in the API and it is not explained well and has no examples of how to use it.
waait a minute…is this saying that Fire 1, or mouse button 1 automatically behaves as a Tap?
Is there a good book or anything that has the core foundations of scripting for iOS unity? I keep finding books that basically say drop the joystick prefab and buy a character from mizamo…I need real examples.
I found this for you and I know angrybots was ported to the iphone as well you may be able to find a ton of reference scripts inside the demo
thanks man, Im gonna try and wrap my head around this API. Appreciate it.