/// <summary> /// Sends the OnLevelWillBeUnloaded message to all game objects in the scene in case they /// need to change their behavior. For example, scripts that do something special when /// destroyed during play may not want to do the same thing when being destroyed by a /// level unload. /// </summary> public static void LevelWillBeUnloaded() { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Broadcasting that level will be unloaded.", new System.Object[] { DialogueDebug.Prefix })); } Tools.SendMessageToEveryone("OnLevelWillBeUnloaded"); }
/// <summary> /// Sends the OnApplyPersistentData message to all game objects in the scene to give them an /// opportunity to retrieve their state from the Lua environment. /// </summary> public static void Apply() { if (DialogueDebug.LogInfo) { Debug.Log(string.Format("{0}: Applying persistent data from Lua environment.", new System.Object[] { DialogueDebug.Prefix })); } Tools.SendMessageToEveryone("OnApplyPersistentData"); }
private static void SendPersistentDataMessage(string message) { switch (recordPersistentDataOn) { case RecordPersistentDataOn.AllGameObjects: Tools.SendMessageToEveryone(message); break; case RecordPersistentDataOn.OnlyRegisteredGameObjects: foreach (var go in listeners) { if (go != null) { go.SendMessage(message, SendMessageOptions.DontRequireReceiver); } } break; default: break; } }