Performance Issues

terraform

New member
Good evening hope all is well.

I have been noticing mini freezes when a player picks up a dropped item. The game uses a item shape grid for its inventory. I decided to run the profiler to see whats going on. Is there supposed to be this many calls? **EDIT - So looks like when I compile the game, and run the profiler it still freezes when I pickup items, HOWEVER if I stop profiling on the compiled game the freezing stops when picking up items.

1668296961515.png

I'm also experiencing another issue which isn't particularly a UIS issue. I'm having the same issue described above when an enemy drops an item and the canvas for the item name enables above the dropped item. I profiled it, and it showed that it was the horizontal layout group and Content Size Fitter on the ItemPickup prefab. I removed the two components, and that fixed the mini freeze issue. So my question is, is there another way to scale the canvas depending on the horizontal/vertical size of the text that wouldn't cause performance hitches?

1668299604488.png
 
Last edited:
First of all, are you profiling on the target device?
Notice that profiling on the Editor won't show you the "real" results as many scripts have editor only / visual debugging code running.
As for the LayoutGroups and COntentSizeFitter, you'll find alot of forum threads talking about it. Essentially the more you can avoid them to be always active the better.
Some choose to write their own code for laying out objects, others simply enable/disable those component startegically to avoid spending computation when not necessary.
I think it is worth playing around witht the anchor points and TMPro text auto scaling, if your issue is with text only.
You can disable the layoutGroup component if you don't need it at runtime.

I hope that points you in the right direction
 
Top