miwarnec / uMMORPG

4 stars 0 forks source link

Learning Skills Drops Performance #32

Closed ghost closed 4 years ago

ghost commented 4 years ago

Versions

Unity Version: 2018.3.6f1 uMMORPG Version: v1184 Are you using a fresh uMMORPG version without any modifications? Yes

Describe the bug When a Player learns numerous new skills it causes a significant drop in performance

To Reproduce

  1. Import 1184
  2. Check FPS
  3. Duplicate a skill, e.g. Strong Hit 40 times, place on Player prefab
  4. Select all Strong Hit scriptableskills > tick learn default
  5. Play & check FPS

System Operating System: Windows 10

Additional context: -when learn default is unchecked on skills, no performance hit with additional UI closed -when learn default is unchecked on skills, performance hit with skillbook UI open (additional degradation scrolling through skillbook UI skills)

-when learn default is checked on skills, performance is still decreased after manually clearing skillbar UI so it has empty slots and other UI closed

image image

miwarnec commented 4 years ago

from davil in discord: image "Here are my results with 32 skills...#dx4d-skillbooks made it a LOT easier to set up this test. With a little testing I determined that it is not the UI at fault and thus the fix Vis provided recently does not address the issue. @vis2k you can replicate this error by simply adding 32 unique skills to a player prefab and comparing FPS before and after doing so. You can see the FPS change at runtime by turning off the Player component and the FPS will jump back up to 100 again. This has been a longstanding bug at least a couple years now...maybe we can finally track it down."

miwarnec commented 4 years ago

looking into this today. can confirm

miwarnec commented 4 years ago

ok guys, found your problem: when you add 40 skills with learn default, Player.LateUpdate calls animator.SetBool(skillname).

if your animator doesn't have the skillname as parameter (e.g. Strong Hit 1, Strong Hit 2, etc.) then the Animator logs a warning to the console. This is why fps drop from 90fps to 15fps with 40 skills (on my machine).

If you add the parameters to the animator then the fps stays the same: image

opening the UI slows it down to about 70 fps - which is kind of expected because Unity's UI is a bit slow, and it's 40 skills after all.

closing this.