Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Question Bad performance using Unity Remote AND after building the app.

Discussion in 'Scripting' started by Edzard, Sep 12, 2021.

  1. Edzard

    Edzard

    Joined:
    Jan 21, 2019
    Posts:
    5
    Hey guys,

    I'm making an android game, which I continuously test by using Unity Remote. It suddenly started to show poor performance. I wish it was my code but it doesn't seem like so.

    I used the profiler for the first time, and I can't jump into conclusions by looking at the processes in the timeline. But I could confirm that the low performance only happens when I use my phone to play or test.

    Play or test... because it happens either when I connect Unity Remote or when I build the app and play from my phone directly, and doesn't happen when I use "Play Mode" in Unity editor without my phone connected through Unity Remote. As far as I know, when you use Unity Remote, it's the PC who executes the app and not the remote device, so I don't understand why this is happening in those situations solely.

    upload_2021-9-12_16-1-16.png
    The mountain corresponds to frames in which I had Unity Remote connected. To connect it, I paused the "Play Mode" and changed "Project Settings/Editor/Unity Remote/Device" from "None" to "Any Android Device", and then I resumed "Play Mode".

    I assume that the problem are the Physics2D step, simulate, etc... orange processes, but as far as I know, I have nothing inside FixedUpdate as suggested in other posts.

    I'll provide as many screenshots as I can so you can help me.

    Thanks in advance.
     
  2. Feretive

    Feretive

    Joined:
    Jul 17, 2021
    Posts:
    19
    Here is some solution it could help
    1.You need to try fix your Spaghetti code if you have(Spaghetti code mean bad code)
    2. Optimizing your game make it suitable for all devices
    3. Not use unity Obfuscator(it will make your game more slower it add fake code to your game it make your game more heavier) anyway use a Obfuscator is not important no matter what Obfuscator you use cracker will always find a way to decompile it.
    4. Remove things in your game project that you not use in the project
     
  3. Edzard

    Edzard

    Joined:
    Jan 21, 2019
    Posts:
    5
    Nevermind, the piece of code I wrote had a typo, making the colliders of multiple instances of an object a bit bigger, making them constantly collide with each other.

    That's the reason for all those Physics2D processes taking all that time to finish in each frame.