Animation Sync iPhone

Hi!

Im having a problem here, an Artist made an animation of a soccer playing running over the stadium.

at some point of the animations, an opponnent try to take the ball from us, so i show a few buttons on the screen, and if the Player touchs its before a little time , the soccer player pass the oponnent, if dont, i change the scene with Application.Loadlevel to a fail scene.

My problem is… i want to hardcode the moments in the animation where the buttons should appear, im used FixedUpdate and doing something like :

if (Time.frameCount > 25  Time.frameCount < mPhase1Duration)
		{
			if (mPhase1 == false)
			{
				mPhase1 = true;
				EnableButtons();
			}
			CheckTouchesState();
		}

In the fixed update, where mPhase1Duration is an integer hardcoded by me indicating the number of frames.

In the Unity Editor works just fine, but in the iPhone the buttons appear much later (i suppose that maybe is some drop frames problem).

Ive tryed Time.realTimeSinceStartup but doesnt seems to work on the device, it does in the Editor.

Sorry if my english is not good, is not my first language.

Thanks in advance!

The GUI system is relatively slow on the iPhone, and may not work well for an in-game GUI like yours. Another approach is to show a single texture (say using GUI.DrawTexture or on an object in the scene) and define some rectangles that correspond to where these textures appear on the screen. Then, you can check if the touch position is inside a rectangle using Rect.Contains and activate the right effect for the “button”:-

var buttonRect: Rect;
var touch = iPhoneInput.touches[0];

if (buttonRect.Contains(touch.position)) {
   // Do something.
}