I want to convert a functioning standalone build to an ipad build. I thought that I might be able to simply change the GUI.Button trigger function to Input.GetButtonDown but I am not sure how to make it work properly. I thought i might just be able to go from this:
var customButton : GUIStyle;
var testanims = new Array("idle","pulse","ascend","waver","bounce","toot");
function OnGUI() {
if(GUI.Button(Rect(50,200,140,400),"",customButton))
{
animation.CrossFade(testanims[Random.Range(0,testanims.length)]);
animation.CrossFadeQueued("idle");
}
}
to this:
var customButton : GUIStyle;
var testanims = new Array("idle","pulse","ascend","waver","bounce","toot")
function OnGUI() {
if(Input.GetButtonDown(Rect(50,200,140,400),"",customButton))
{
animation.CrossFade(testanims[Random.Range(0,testanims.length)]);
animation.CrossFadeQueued("idle");
}
}
but it says that it is not compatible with the argument list.Is there a simple of way of doing this correctly ?
The first block of code should work on ipad as well. `Input.GetButtonDown` is for keys on keyboard, taking names as defined in the input manager (such as as `"Fire"` and `"Jump"`). See the docs.