This script runs Lua code when the game object is destroyed. More...
Public Member Functions | |
void | OnDestroy () |
Run Lua code (and check alerts) when the game object is destroyed. | |
void | OnLevelWillBeUnloaded () |
If the level is being unloaded, this GameObject will be destroyed. | |
Public Attributes | |
string | luaCode |
The lua code to run. | |
This script runs Lua code when the game object is destroyed.
You can use it to record kills by attaching it to enemy NPCs.
|
inline |
Run Lua code (and check alerts) when the game object is destroyed.
It's possible that the game object is being destroyed because the application is stopping. In this case, the DialogueManager instance may have already been destroyed. We check the value of our reference to prevent accidentally creating a new DialogueManager.
|
inline |
If the level is being unloaded, this GameObject will be destroyed.
We don't want to run Lua in this case, so disable the script.
string PixelCrushers.DialogueSystem.RealisticFPSPrefabSupport.LuaOnDestroy.luaCode |
The lua code to run.
For example: Variable["Kills"] = Variable["Kills"] + 1