This persistent data component keeps track of when the GameObject has been destroyed or disabled. More...
Public Types | |
enum | RecordOn { RecordOn.Destroy, RecordOn.Disable } |
Public Member Functions | |
void | OnApplyPersistentData () |
When applying persistent data, check the variable. More... | |
void | OnLevelWillBeUnloaded () |
If the level is being unloaded, this GameObject will be destroyed. More... | |
void | OnApplicationQuit () |
If the application is ending, don't listen, as this can log errors in the console. More... | |
void | OnDestroy () |
If the GameObject is destroyed, set its Lua variable true . More... | |
void | OnDisable () |
Public Attributes | |
RecordOn | recordOn = RecordOn.Destroy |
string | variableName = string.Empty |
Assign a Lua variable name to keep track of whether the GameObject has been destroyed. More... | |
GameObject | spawnWhenDestroyed |
Protected Member Functions | |
virtual void | OnEnable () |
Only listen for OnDestroy if the script has been enabled. More... | |
Protected Attributes | |
bool | listenForOnDestroy = false |
Properties | |
string? | ActualVariableName [get] |
This persistent data component keeps track of when the GameObject has been destroyed or disabled.
The next time the level or game is loaded, if the GameObject has previously been destroyed/disabled, this script will destroy/deactivate it again.
void PixelCrushers.DialogueSystem.PersistentDestructible.OnApplicationQuit | ( | ) |
If the application is ending, don't listen, as this can log errors in the console.
void PixelCrushers.DialogueSystem.PersistentDestructible.OnApplyPersistentData | ( | ) |
When applying persistent data, check the variable.
If it's true
, the GameObject has been destroyed previously, so destroy it now.
void PixelCrushers.DialogueSystem.PersistentDestructible.OnDestroy | ( | ) |
If the GameObject is destroyed, set its Lua variable true
.
void PixelCrushers.DialogueSystem.PersistentDestructible.OnDisable | ( | ) |
|
protectedvirtual |
Only listen for OnDestroy if the script has been enabled.
void PixelCrushers.DialogueSystem.PersistentDestructible.OnLevelWillBeUnloaded | ( | ) |
If the level is being unloaded, this GameObject will be destroyed.
We don't want to count this in the variable, so disable the script.
|
protected |
RecordOn PixelCrushers.DialogueSystem.PersistentDestructible.recordOn = RecordOn.Destroy |
GameObject PixelCrushers.DialogueSystem.PersistentDestructible.spawnWhenDestroyed |
string PixelCrushers.DialogueSystem.PersistentDestructible.variableName = string.Empty |
Assign a Lua variable name to keep track of whether the GameObject has been destroyed.
If this is blank, it uses the name of the GameObject for the variable name. If the variable is true
, the GameObject has been destroyed.
|
getprotected |