Simple Game is laggy on iOS

Hello,

I’m very new in Unity. I’m trying to run a simple code on iOS and it is laggy, it performs good on unity preview. My CharacterController is a simple sprite and I don’t have anything else on the screen.

I also tried to create a 3D project with a sphere, running a similar code has the same result on iOS.

Can anyone point me to the right direction in what do I need to do to fix this performance issue on the iOS?

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class FPSWalker : MonoBehaviour
{
private CharacterController controller;
private float speed = 5.0f;
private Vector3 moveVector;
private float verticalVelocity = 0.0f;
private float gravity = 12.0f;

//Usethisfor initialization
void Start (){
controller = GetComponent<CharacterController> ();
}

//Updateiscalledonceper frame
void Update (){
moveVector = Vector3.zero;

if (Input.GetMouseButtonDown(0)) {
verticalVelocity = 6.0f;
} else {
verticalVelocity -= gravity * Time.deltaTime;
}

//X-Left& Right
moveVector.x = Input.GetAxisRaw ("Horizontal") * speed;

//Y-Up& Down
moveVector.y = verticalVelocity;

controller.Move (moveVector * Time.deltaTime);

Vector3 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
if (screenPosition.y > Screen.height || screenPosition.y < 0){
Die();
}
}

void Die(){
SceneManager.LoadScene (SceneManager.GetActiveScene ().name);
}
}

I was able to solve the problem by creating an Empty Object, with the following code:

void Awake(){
        Application.targetFrameRate = 60;
    }

Hope that this would be useful to someone.