Example 5
In this example instead of setting up AI Character, we will setup completly different actor - Bonfire.
Bonfire should be on fire only when player is within 2000 radius.
When player is between 1500-2500 radius, it will be extinguished.
And when player is above 2500 radius, it will be despawned.
Setup of subject component would look like that
- We want AI to be updated by subsystem right after its spawn, thus CanBeUpdatedBySubsystem is set to true.
- We don't want to allow subsystem to spawn/despawn this subject, thus AllowSubsystremToDespawn is set to false.
- Priority doesn't matter in this case, it can be left at 0.
- We don't save any data, thus DataClass can remain empty.
- We want to optimize this actor on 15000 & 2500 radius, thus there are 2 Optimizations Layers with those radiuses.
- We don't need to know whether subject is seen or not by Invokers, thus ShouldCalculateIsSeen is set to false.
Setup of OnOptimizationUpdate event would look like that
This way this fire will only be activated when player is in layer 0, and actor will be despawned when player is beyond last layer.