Thanks to the project you sent us I belive I was able to reduce the processing for Death and respawn considerably.
For death I made the following changes:
- added an option to prevent items from being dropped on death, so that they can simply be removed
- In the integration I stop the bridgeEquippableProcessing from updating while I am Removing all items. And update only once the remove is complete.
- Added a function to remove all items in the UIS inventory which disables executing the update event while looping over the items removed
- Added the same disable executing update event functionality on UIS ItemCollections, when removing all items
- Fixed a bug the Recipe Panel which was refreshing on inventory updated even thoug it was disabled
So now both Inventory and ItemCollection only send a single Update event after all items have been removed, instead of once for each item removed.
With those changes I went from 30ms on death to not being able to find it anymore in the profiler which means it should be under 2-4ms
For respawning/loading the default loadout I changed:
- Creating Mutable Items is now more performant due to some changes on creating and dupplicating attributes at runtime.
- In UCC improved Animator snapping to avoid as many OnAnimatorMove callbacks as possible
- In the integration loading loadout now disabled itemCollection updates and BridgeEquippable events until all items are added, then the update is called manually.
With those changes we went from 40ms to under 20ms on respawn.
Things we still need to improve but cannot be done without major refactor:
- Reduce string comparators with attributes
- Creating Character item at runtime, even if they are pooled, there is still a lo of initialization time.
- Creating Item Sets at runtime with the ItemSetRules. Creating ItemSets creates a Default State Preset at runtime which is slow.
- SnapAnimator still calls Animator.Update() 2-3 times. It does so before and after items are added by the loadout.
Those are the main changes I made, I also made quite a few smaller changes. You should see some pretty big improvements once you use those changes.
But unfortunatly I made changes to alot of files so I can't send you everything in the forum. I also need to discuss with Justin to make sure the changes I made to UCC doesn't break anything. We also need to discuss the other points which could be refactored for performance.
Once we are happy with the changes and made sure they do not break anything we will release an update.