Component > Dialogue System > Actor > Increment On Destroy
Increment On Destroy increments a Lua variable when the GameObject is destroyed or disabled.
| Property | Function |
|---|---|
| Increment On | (Not shown in screenshot) Specifies whether to increment when the GameObject is destroyed or disabled |
| Variable | The Lua variable to increment. This variable will be created if it's not already defined in the dialogue database |
| Increment | The amount to increment. Negative amounts decrement the value |
| Min | Guaranteed minimum value for the variable after incrementing |
| Max | Guaranteed maximum value for the variable after incrementing |
| Alert Message | (Not shown in screenshot) An optional alert message to show. Can include Dialogue Markup Tags |
This component is useful for kill quests or collection quests, as you can increment a counter every time the player kills or collects a specific GameObject.
Note that loading a new level will disable and destroy GameObjects in the current level. If you don't want to increment the variable in this situation, call PersistentDataManager.LevelWillBeUnloaded() before loading the new level.
<< Components