|
Post by xxscrumexx on Aug 9, 2018 5:27:29 GMT
Hey all, I am having a strange issue when I have my character pick up the ammo prefab from the Invector Shooter weapons prefab folder. I am seeing a 20-50% drop in framerate upon the adding of the ammo number. The pickup itself seems fine but as soon as the ammo count is increased there is a momentary pause and then everything is fine again. I have ran the game with profiler and all that seems to indicate is that I do indeed have a FPS drop. Any suggestions as to where I should start to look for the trouble? TIA
|
|
|
Post by Invector on Aug 9, 2018 16:21:36 GMT
What Unity version are you using? I've noticed that on the last updates they change how prefabs work and I also notice some considerable drops when instantiating weapon prefabs, I still need to check if this only happens while in the Editor or also when running a compiled build.
|
|
|
Post by xxscrumexx on Aug 9, 2018 19:17:40 GMT
This is on version 2017.31f1. We tried updating to other versions and the issues were far to many to fix before the conclusion of our project timeframe. I can confirm that this drop happens in both the editor and when running a compiled build. Would it be better if it were not in a prefab, simply break the prefab instance and then duplicate that non-prefab item?
|
|
|
Post by xxscrumexx on Aug 13, 2018 6:34:12 GMT
I tried to break the prefab and then pick it up - same result. I tried creating a new ammo pickup - same result. It has to do with when the ammo count is increased in the ammo display. If I delay the adding of the ammo I can pick it up no problem and then after the delay when the ammo count is increased the frame rate will drop by 50% or more, sometimes clear down to 2 FPS. Any suggestions?
|
|
|
Post by tharindu on Aug 13, 2018 10:35:19 GMT
Could you try upgrading to 2017.4 ? It's the most stable version I can recommend right now in the 2017 line up. I've almost always had issues in the other versions. Couldn't recreate this issue either.
|
|
|
Post by xxscrumexx on Aug 14, 2018 1:55:56 GMT
I downloaded the 2017.4 and am still having the same issue. I attached a screengrab of my profiler window at the moment of the ammo being added to the ammo count. I am running this on 2018 Alienware R7 with a 8th Gen i7, 32GB of DDR4 Ram, GTX1080, and running from my SSD. Everything should be real smooth I would think.
|
|
|
Post by xxscrumexx on Aug 15, 2018 7:54:29 GMT
I downloaded the 2017.4 and am still having the same issue. I attached a screengrab of my profiler window at the moment of the ammo being added to the ammo count. I am running this on 2018 Alienware R7 with a 8th Gen i7, 32GB of DDR4 Ram, GTX1080, and running from my SSD. Everything should be real smooth I would think. Here is another screen grab that shows that it is the "FindObjectsOfType" in v_AIController.StateRoutine() [Coroutine: MoveNext] that is causing the lag in that it jumps from little CPU usage to 89%. Not sure why the AIController would have any issues with an ammo pickup being added to the player controller. Again, any insight as to why this would occur would be greatly appreciated as we are in the final 2 weeks of our capstone project for school and are coming up with nothing as far as how to fix this issue.
|
|
|
Post by Invector on Aug 15, 2018 19:07:21 GMT
It's very curious because testing here at 5.6.2 there is no spike at all
|
|
|
Post by ceebeee on Aug 16, 2018 5:08:42 GMT
I was curious to see if I saw this as well on 2017.4, but I don't. At least not in the default demo scene that comes with the package.
If I had to hazard a guess, you're seeing this in your full custom game scene, which likely contains far more gameObjects than the demo does. In that scenario, any type of Find*() function is going to be a huge hit, as it has far more gameObjects to search through.
FindObjectsOfType() is only used in one place in the whole Invector Codebase:
vShooterManager.cs, where it finds the "vAmmoDisplay" types. So I would focus there. Perhaps finding a way to do the same thing without using FindObjectsOfType would speed things up.
|
|
|
Post by xxscrumexx on Aug 16, 2018 5:48:37 GMT
I was curious to see if I saw this as well on 2017.4, but I don't. At least not in the default demo scene that comes with the package. If I had to hazard a guess, you're seeing this in your full custom game scene, which likely contains far more gameObjects than the demo does. In that scenario, any type of Find*() function is going to be a huge hit, as it has far more gameObjects to search through. FindObjectsOfType() is only used in one place in the whole Invector Codebase: vShooterManager.cs, where it finds the "vAmmoDisplay" types. So I would focus there. Perhaps finding a way to do the same thing without using FindObjectsOfType would speed things up. Yes, we have quite the asset list and I can definitely see how that would be a huge impact on performance. Thank you for the suggestion. That is the direction that we were thinking next just not sure exactly how that worked. We'll look into a way to directly assign it instead of finding it. Thank you again. I'll post if that thought path is successful for us.
|
|
|
Post by xxscrumexx on Aug 23, 2018 1:46:55 GMT
Quick update. I was able to solve this issue by using the non-inventory ammo pickups. Zero FPS drop as the item is not searching through our entire project for the ammo display. Thank you for all the suggestions and help.
|
|