Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Slow animation on iOS

Discussion in 'iOS and tvOS' started by twbowen, May 7, 2015.

  1. twbowen

    twbowen

    Joined:
    Sep 27, 2013
    Posts:
    30
    Hi all,

    I'm in the process of converting my android game to iOS, but for some reason (which I think I might know the reason behind) it's much slower on iOS devices. A few things I've gathered from the forums and some general info...

    * iOS forces v-sync, so anything that's frame-rate dependent could slow down
    * I don't have Application.targetFrameRate set, though it seems some recommend it?
    * I tried "Every v-blank" in the settings
    * Android version runs between 100-200 FPS

    The slow animation in question is called by a coroutine that steps through to the target rotation/position.....

    Code (CSharp):
    1.     IEnumerator DoRoll(Vector3 myPivot, Vector3 aAxis, float aAngle, float aDuration) {
    2.        
    3.         aPoint = myPivot;
    4.         tSteps = Mathf.Ceil(aDuration * 60.0f);
    5.         tAngle = aAngle / tSteps;
    6.  
    7.         for(var i=1; i<=tSteps; i++) {
    8.             transform.RotateAround (aPoint, aAxis, tAngle);
    9.             yield return new WaitForSeconds(.01f);
    10.            
    11.         }
    Now, my assumption is that I need to instead put this in some kind of time.deltatime loop rather than the fixed coroutine?

    The other possibility is forcing 60fps, is that possible with Application.targetframerate? If so, what do I set the vsync setting to?

    Thanks for any input/advice. I might be able to show some profiler info later but I'm at work at the moment.
     
  2. twbowen

    twbowen

    Joined:
    Sep 27, 2013
    Posts:
    30
    Should I maybe be putting this animation in a fixedupdate rather than a coroutine?
     
  3. twbowen

    twbowen

    Joined:
    Sep 27, 2013
    Posts:
    30
    Just an FYI, all fixed by targetFrameRate!
     
    wetcircuit and SuppleTeets like this.
  4. SuppleTeets

    SuppleTeets

    Joined:
    Aug 22, 2014
    Posts:
    30
    Was having issues on Oculus Quest and this fixed it, thanks!