Example 1


All examples can be found in Example Project section

In this example we will setup AI Character in simplest possible way.
If distance from AI ( Subject ) to Player ( Invoker ) is above 2000, then it will be despawned
and when it's less than 2000 then AI is spawned.


Setup of SubjectComponent will look like that

  • We want AI to be updated by subsystem right after its spawn, thus CanBeUpdatedBySubsystem is set to true.
  • We want to allow subsystem to spawn/despawn this subject, thus AllowSubsystemToDespawn is set to true.
  • We want AI to be despawned when there isn't any Invoker within 2000 radius, thus OverrideSubsystemDespawnRadius is set to 2000.
  • Priority doesn't matter in this case, it can be left at 0.
  • We don't save any data of AI so DataClass can remain empty.
  • We don't use OptimizationLayers because everything is handled by subsystem, thus it remains empty.
  • We don't need to know whether AI is seen or not because system only spawns/despawns this subject based on radius to Invokers, thus ShouldCalculateIsSeen is set to false.