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. Dismiss Notice

Resolved Low fps just from 1 rigidbody 2D

Discussion in '2D' started by KeyGameUniverse, Aug 29, 2020.

  1. KeyGameUniverse

    KeyGameUniverse

    Joined:
    Jul 18, 2013
    Posts:
    39
    Hello guys, i am working on an action game in unity. I am a single developer with some experience on Unity but this is the first time i rely on unity physics. I already have my main character with 4 colliders and a rigidbody. The game is running around 70-80 fps on the editor. Now i wanna add enemies, so i added the bellow circled gameobject that is .psb file and fully rigged. I run it again and still same fps.
    upload_2020-8-29_23-44-26.png

    Now when i add a rigidbody 2D to the enemy. The fps is at 10-20...It only happens when the enemy moves. I am at a loss here as i didn't expect just 2 rigidbodies on the screen to affect it so much. (Main Character and 1 enemy). I am sure i do something wrong. If you have any idea on what i could improve i will do it...The game will nedd to be stable fps with at least 4-5 enemies on the screen and i can't even put 1.

    upload_2020-8-29_23-46-40.png
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,319
    KeyGameUniverse likes this.
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,533
    A single body in physics won't cause that kind of overhead so it's likely that by adding that something else is running
    such as a collision callback and your script(s) etc.

    The FPS counter in the editor isn't a good indicator of performance and certainly not useful for figuring out what is actually taking time. I would suggest you also look at the Profiler (there's lots of tutorials on it).
     
    KeyGameUniverse likes this.
  4. KeyGameUniverse

    KeyGameUniverse

    Joined:
    Jul 18, 2013
    Posts:
    39
    I found the problem guys , thanks for all the help.

    upload_2020-8-30_16-48-26.png

    The problem was actually the skinning editor of the sprites.

    For anyone having the same problem as me. Do the following.

    Go to Windows -> Package Manager

    Download Collections and Burst. Then restart Unity. It boosted my fps 4x times the normal amount i had before.
     

    Attached Files:

    MelvMay likes this.
  5. thethoam

    thethoam

    Joined:
    May 28, 2018
    Posts:
    1
    thx man this burst Collections is so good i can create from 2 enemy with 15fps to 20 enemy 60fps