Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug My game works fine on android devices but freezes on IOS devices

Discussion in 'Editor & General Support' started by firatyasin0233, Feb 20, 2023.

  1. firatyasin0233

    firatyasin0233

    Joined:
    Jul 28, 2021
    Posts:
    7
    Hello,

    Problem: it works with low fps. When I move the screen to move the player to the right or left, it detects the movement after 3 or 4 seconds.


    I have this problem on IOS devices.

    The package I used: Toony Colors ( i doubt that )

    There is no problem in the codes I wrote. I've reviewed them all. I was careful when doing the Time.deltaTime and Time.fixedDeltaTime operations.

    The script below is running 3 or 4 seconds late. (I called within the Update method)

    Code (CSharp):
    1.  public void Turn()
    2.     {
    3.         if (TouchController.Instance.canMove)
    4.         {
    5.             swap = TouchController.Instance.getTouchPosition.x;
    6.          
    7.             if (isDamageRightBorder || isDamageLeftBorder)
    8.             {
    9.                 swap = 0;
    10.             }
    11.         }
    12.         else
    13.         {
    14.             swap = 0;
    15.         }
    16.  
    17.         if (Mathf.Abs(swap) < .9)
    18.         {
    19.             swap = 0;
    20.         }
    21.  
    22.      
    23.         turn.SetTurnValue(swap * direction).SetFrame(Time.deltaTime).Execute();
    24.     }
    I checked the necessary optimization settings by watching the video below



    Player Settings :

    *Target DPI : 310

    Others :






    Quality :

     
    Last edited: Feb 20, 2023
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,519
    If you DO have a problem, there is only ONE way to find out. Always start by using the profiler:

    Window -> Analysis -> Profiler

    Failure to use the profiler first means you're just guessing, making a mess of your code for no good reason.

    Not only that but performance on platform A will likely be completely different than platform B. Test on the platform(s) that you care about, and test to the extent that it is worth your effort, and no more.

    https://forum.unity.com/threads/is-...ng-square-roots-in-2021.1111063/#post-7148770

    Remember that optimized code is ALWAYS harder to work with and more brittle, making subsequent feature development difficult or impossible, or incurring massive technical debt on future development.

    Notes on optimizing UnityEngine.UI setups:

    https://forum.unity.com/threads/how...form-data-into-an-array.1134520/#post-7289413

    At a minimum you want to clearly understand what performance issues you are having:

    - running too slowly?
    - loading too slowly?
    - using too much runtime memory?
    - final bundle too large?
    - too much network traffic?
    - something else?

    If you are unable to engage the profiler, then your next solution is gross guessing changes, such as "reimport all textures as 32x32 tiny textures" or "replace some complex 3D objects with cubes/capsules" to try and figure out what is bogging you down.

    Each experiment you do may give you intel about what is causing the performance issue that you identified. More importantly let you eliminate candidates for optimization. For instance if you swap out your biggest textures with 32x32 stamps and you STILL have a problem, you may be able to eliminate textures as an issue and move onto something else.

    This sort of speculative optimization assumes you're properly using source control so it takes one click to revert to the way your project was before if there is no improvement, while carefully making notes about what you have tried and more importantly what results it has had.
     
    firatyasin0233 likes this.
  3. firatyasin0233

    firatyasin0233

    Joined:
    Jul 28, 2021
    Posts:
    7
    Hello, first of all thank you for your clarifications.

    I created a different algorithm by completely changing the algorithm of the game. The problem is fixed. However, there was no idea about why the problem occurred, other than assumptions.

    Since I do not have a Macbook computer, I could not actively test the game in profiles. I was having the problem only on an ios device. I had this problem because ios's cpu architecture is different from andiod's cpu architecture.

    I always thought that the ios cpu architecture was much better than the cpu architectures of android devices.That's why I was thinking that the game that runs optimized on Android will run smoothly on all kinds of iOS.

    Thank you very much for taking the time to reply. I will act in the light of the information you have given in my next games.