I have a GUIText- “play” on a scene called Title. When play is touched, I want the application to load the title scene. The following is the code that I have written and attached to the GUIText, and isn’t working:
function Update(){
var count = iPhoneInput.touchCount;
for (var i: int = 0; i < count; i++){
var touch : iPhoneTouch = iPhoneInput.GetTouch(i);
if (GUIText.HitTest( touch.position )){
Application.LoadLevel(“Crush”)
}
}
}
Any ideas (please)?
Hi, welcome to the forum!
Are you showing more than one camera view on the screen at once? If so, the HitTest function has an optional second parameter that lets you choose which camera to use. If not, you could try adding print statements to the code to determine whether it is the HitTest or LoadLevel call that fails. Are you seeing any error messages, by the way?
Hey thanks alot, yeah I kinda figured it out. For some reason my game won’t load the main two levels but will load some of the other ones. I really have no idea why this is happening. Two scenes load two scenes do not, for the two scenes that do not when you press the screen it just freezes and eventually crashes back to my iphone main screen. Also my buttons don’t seem to be working correctly. You can press anywhere on the screen and they work instead of being only on the button. Any ideas for either one of these??