Ninja Bear Studio Plugins Help

Lazy Loading

You may have multiple actors in the world that may require their own Ability System Component. However, having multiple instances of the ASC can be heavy, potentially leading to performance issues. Lazy Loading can help alleviating that problem.

The default actor provided by Ninja GAS, NinjaGASActor, supports this design pattern, allowing you to define for each actor type the initialization mode for the Ability System Component:

  • Lazy: The Ability System Component is only initialized when used for the first time. This is the default setting for NinjaGASActor blueprints.

  • Eager: The Ability System Component is initialized as soon as possible.

Default Ability Data

The base NinjaGASActor does not include an instance of the Ability System Component in the editor's Defaults pane. This means you cannot directly assign the** Data Asset** to the ASC within the editor

As an alternative to that, this base actor class implements AbilitySystemDefaultsInterface, which allows blueprints to set the appropriate Data Asset directly in the Actor Property DefaultAbilitySetup.

Alternatively, you can create your own version of the Ability System Component, already set with the appropriate Data Asset to be used during the initialization.

Attribute Sets

Because the Ability System Component might not yet be initialized when a Gameplay Effect is applied to an actor, Attributes must be stored in a temporary structure and later on applied to the newly-create ASC.

The framework will handle this for you, but you must change the macro used in your Replication Notifies. Instead of using GAMEPLAYATTRIBUTE_REPNOTIFY, you should use LAZY_GAMEPLAYATTRIBUTE_REPNOTIFY instead.

Last modified: 12 January 2025