Loading Only the GameplayCues that are Needed in a Match?

By default, the GameplayCueManager scans the entire project for GameplayCues and loads every one it finds at startup. I have almost 200 GameplayCues with many more to be made in my current project using the Paragon Assets which amounts to almost a gigabyte of data being always loaded into memory. This results in the game being frozen on startup while it loads every GameplayCue for ~10-20 seconds on my computer, longer for players with slower computers.

Most of the GameplayCues are used by characters not existing in the current match and should not be loaded. How can I load only the GameplayCues needed in the current match’s level and characters?

I know that I can restrict the “always loaded global GameplayCues” to specific directories by setting “GameplayCueNotifyPaths” in DefaultGame.ini. But if the GameplayCues aren’t in one of those directories, they won’t load at all in PIE (haven’t tried making a packaged game with GCs not in the GameplayCueNotifyPaths but I assume they won’t load either).

I think the way it’s supposed to work is

  1. Put GameplayCues always used in every match in directories listed in GameplayCueNotifyPaths for the runtime cue set.
  2. The Editor should somehow point to the entire project or at least where all the GameplayCues live for its editor cue set. To my understanding, the editor cue set will never async load the cues into memory. This is just for listing them in the GameplayCue Editor and for tracking references of GameplayCue GameplayTags so it’s ideal to have every GameplayCue in the editor cue set.
  3. Somehow during the transition map/loading or start of level add all the GameplayCues used by the match’s level and characters into the runtime cue set and load them into memory.
  4. At the end of the match somehow unload the level’s and characters’ GameplayCues from the runtime cue set (unless this gets garbage collected automatically, it’s unclear).

Any guidance on how to properly load only the GameplayCues that I need is much appreciated as having that 10-20 second hard freeze the first time I click PIE every time I restart the editor makes development frustrating and a poor experience for players in my packaged game.

Edit:
In the short term to alleviate the loading in PIE hard freeze, I can override UGameplayCueManager::ShouldAsyncLoadRuntimeObjectLibraries() to return false. This forces all GameplayCues to async load in when they’re actually triggered in-game instead of async loading everything at startup. While I don’t think this is the end solution, this is much much better than loading all GameplayCues on startup - no ~20 second hard freeze and no excess particles/sounds in memory from unneeded GameplayCues.

1 Like