Jerry Zhao
Jerry Zhao

Reputation: 373

How to make a smooth move in iPhone with Unity?

I just make some cube and let them moved vertically on the build, then I found it was really not smooth on iPhone, could any one help me out?

void Update () {
    transform.Translate (0, Time.deltaTime * 3, 0); 
}

Upvotes: 1

Views: 388

Answers (2)

Hamza Hasan
Hamza Hasan

Reputation: 1398

At very first script of Build (SplashScreen) normally, write

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

Then in your code in Update modify code as,

void Update () {
    transform.position = Vector3.MoveTowards (transform.position, new Vector3 (0, -16, 0), Time.deltaTime * 3); 
}

-16 is the target value of Y, you can change it.

Upvotes: 2

Jerry Zhao
Jerry Zhao

Reputation: 373

At last, I found where the problem was, that because Unity had limit framerate at 30, it run smoothly after I setting it again.

Application.targetFrameRate = 60;

Upvotes: 1

Related Questions