diff --git a/Assets/Fungus/Animation/Scripts/Commands/ResetAnimTrigger.cs b/Assets/Fungus/Animation/Scripts/Commands/ResetAnimTrigger.cs index 9bdc1834..70f08844 100644 --- a/Assets/Fungus/Animation/Scripts/Commands/ResetAnimTrigger.cs +++ b/Assets/Fungus/Animation/Scripts/Commands/ResetAnimTrigger.cs @@ -9,7 +9,8 @@ namespace Fungus "Reset Anim Trigger", "Resets a trigger parameter on an Animator component.")] [AddComponentMenu("")] - public class ResetAnimTrigger : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ResetAnimTrigger : Command { [Tooltip("Reference to an Animator component in a game object")] public AnimatorData _animator; @@ -47,10 +48,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD; [HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD; - public void OnBeforeSerialize() - {} - - public void OnAfterDeserialize() + protected virtual void OnEnable() { if (animatorOLD != null) { diff --git a/Assets/Fungus/Animation/Scripts/Commands/SetAnimBool.cs b/Assets/Fungus/Animation/Scripts/Commands/SetAnimBool.cs index 2cbd6642..a34ca0a5 100644 --- a/Assets/Fungus/Animation/Scripts/Commands/SetAnimBool.cs +++ b/Assets/Fungus/Animation/Scripts/Commands/SetAnimBool.cs @@ -9,7 +9,8 @@ namespace Fungus "Set Anim Bool", "Sets a boolean parameter on an Animator component to control a Unity animation")] [AddComponentMenu("")] - public class SetAnimBool : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SetAnimBool : Command { [Tooltip("Reference to an Animator component in a game object")] public AnimatorData _animator; @@ -50,10 +51,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD; [HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD; - public void OnBeforeSerialize() - {} - - public void OnAfterDeserialize() + protected virtual void OnEnable() { if (animatorOLD != null) { diff --git a/Assets/Fungus/Animation/Scripts/Commands/SetAnimFloat.cs b/Assets/Fungus/Animation/Scripts/Commands/SetAnimFloat.cs index 096954f5..b220f52c 100644 --- a/Assets/Fungus/Animation/Scripts/Commands/SetAnimFloat.cs +++ b/Assets/Fungus/Animation/Scripts/Commands/SetAnimFloat.cs @@ -9,7 +9,8 @@ namespace Fungus "Set Anim Float", "Sets a float parameter on an Animator component to control a Unity animation")] [AddComponentMenu("")] - public class SetAnimFloat : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SetAnimFloat : Command { [Tooltip("Reference to an Animator component in a game object")] public AnimatorData _animator; @@ -50,10 +51,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD; [HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD; - public void OnBeforeSerialize() - {} - - public void OnAfterDeserialize() + protected virtual void OnEnable() { if (animatorOLD != null) { diff --git a/Assets/Fungus/Animation/Scripts/Commands/SetAnimInteger.cs b/Assets/Fungus/Animation/Scripts/Commands/SetAnimInteger.cs index 29add857..3ce15964 100644 --- a/Assets/Fungus/Animation/Scripts/Commands/SetAnimInteger.cs +++ b/Assets/Fungus/Animation/Scripts/Commands/SetAnimInteger.cs @@ -9,7 +9,8 @@ namespace Fungus "Set Anim Integer", "Sets an integer parameter on an Animator component to control a Unity animation")] [AddComponentMenu("")] - public class SetAnimInteger : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SetAnimInteger : Command { [Tooltip("Reference to an Animator component in a game object")] public AnimatorData _animator; @@ -50,10 +51,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD; [HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD; - public void OnBeforeSerialize() - {} - - public void OnAfterDeserialize() + protected virtual void OnEnable() { if (animatorOLD != null) { diff --git a/Assets/Fungus/Animation/Scripts/Commands/SetAnimTrigger.cs b/Assets/Fungus/Animation/Scripts/Commands/SetAnimTrigger.cs index 935973bf..b3234aa1 100644 --- a/Assets/Fungus/Animation/Scripts/Commands/SetAnimTrigger.cs +++ b/Assets/Fungus/Animation/Scripts/Commands/SetAnimTrigger.cs @@ -9,7 +9,8 @@ namespace Fungus "Set Anim Trigger", "Sets a trigger parameter on an Animator component to control a Unity animation")] [AddComponentMenu("")] - public class SetAnimTrigger : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SetAnimTrigger : Command { [Tooltip("Reference to an Animator component in a game object")] public AnimatorData _animator; @@ -47,10 +48,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("animator")] public Animator animatorOLD; [HideInInspector] [FormerlySerializedAs("parameterName")] public string parameterNameOLD; - public void OnBeforeSerialize() - {} - - public void OnAfterDeserialize() + protected virtual void OnEnable() { if (animatorOLD != null) { diff --git a/Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs b/Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs index e7ae9263..e8dc63bf 100644 --- a/Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs +++ b/Assets/Fungus/Audio/Scripts/Commands/ControlAudio.cs @@ -7,7 +7,8 @@ namespace Fungus [CommandInfo("Audio", "Control Audio", "Plays, loops, or stops an audiosource. Any AudioSources with the same tag as the target Audio Source will automatically be stoped.")] - public class ControlAudio : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ControlAudio : Command { public enum controlType { @@ -262,10 +263,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("audioSource")] public AudioSource audioSourceOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (audioSourceOLD != null) { diff --git a/Assets/Fungus/Audio/Scripts/Commands/PlayUsfxrSound.cs b/Assets/Fungus/Audio/Scripts/Commands/PlayUsfxrSound.cs index 6f1f7eb5..81062ffb 100644 --- a/Assets/Fungus/Audio/Scripts/Commands/PlayUsfxrSound.cs +++ b/Assets/Fungus/Audio/Scripts/Commands/PlayUsfxrSound.cs @@ -7,7 +7,8 @@ "Play Usfxr Sound", "Plays a usfxr synth sound. Use the usfxr editor [Tools > Fungus > Utilities > Generate usfxr Sound Effects] to create the SettingsString. Set a ParentTransform if using positional sound. See https://github.com/zeh/usfxr for more information about usfxr.")] [AddComponentMenu("")] - public class PlayUsfxrSound : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class PlayUsfxrSound : Command { protected SfxrSynth _synth = new SfxrSynth(); @@ -69,10 +70,7 @@ [HideInInspector] [FormerlySerializedAs("SettingsString")] public String SettingsStringOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (SettingsStringOLD != "") { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs index 783efa68..bff05755 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Destroy.cs @@ -9,7 +9,8 @@ namespace Fungus "Destroy", "Destroys a specified game object in the scene.")] [AddComponentMenu("")] - public class Destroy : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class Destroy : Command { [Tooltip("Reference to game object to destroy")] public GameObjectData _targetGameObject; @@ -43,10 +44,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("targetGameObject")] public GameObject targetGameObjectOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (targetGameObjectOLD != null) { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs b/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs index 7c737ca5..293753c9 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/LoadScene.cs @@ -12,7 +12,8 @@ namespace Fungus "usage. Previously loaded assets will be released before loading the scene to free up memory." + "The scene to be loaded must be added to the scene list in Build Settings.")] [AddComponentMenu("")] - public class LoadScene : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class LoadScene : Command { [Tooltip("Name of the scene to load. The scene must also be added to the build settings.")] public StringData _sceneName = new StringData(""); @@ -44,10 +45,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("sceneName")] public string sceneNameOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (sceneNameOLD != "") { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs index 13bc4902..cbaf75c7 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SendMessage.cs @@ -8,7 +8,8 @@ namespace Fungus "Send Message", "Sends a message to either the owner Flowchart or all Flowcharts in the scene. Blocks can listen for this message using a Message Received event handler.")] [AddComponentMenu("")] - public class SendMessage : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SendMessage : Command { public enum MessageTarget { @@ -72,10 +73,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("message")] public string messageOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (messageOLD != "") { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs index 4e0c4a5d..91d6b27f 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SetActive.cs @@ -9,7 +9,8 @@ namespace Fungus "Set Active", "Sets a game object in the scene to be active / inactive.")] [AddComponentMenu("")] - public class SetActive : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SetActive : Command { [Tooltip("Reference to game object to enable / disable")] public GameObjectData _targetGameObject; @@ -46,10 +47,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("targetGameObject")] public GameObject targetGameObjectOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (targetGameObjectOLD != null) { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs b/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs index 6fc6f947..1b15f123 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/SpawnObject.cs @@ -11,7 +11,8 @@ namespace Fungus "Spawn Object", "Spawns a new object based on a reference to a scene or prefab game object.")] [AddComponentMenu("")] - public class SpawnObject : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SpawnObject : Command { [Tooltip("Game object to copy when spawning. Can be a scene object or a prefab.")] public GameObjectData _sourceObject; @@ -67,10 +68,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("spawnPosition")] public Vector3 spawnPositionOLD; [HideInInspector] [FormerlySerializedAs("spawnRotation")] public Vector3 spawnRotationOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (sourceObjectOLD != null) { diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs b/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs index 700afd85..709afe67 100644 --- a/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/Wait.cs @@ -9,7 +9,8 @@ namespace Fungus "Wait", "Waits for period of time before executing the next command in the block.")] [AddComponentMenu("")] - public class Wait : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class Wait : Command { [Tooltip("Duration to wait for")] public FloatData _duration = new FloatData(1); @@ -38,10 +39,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (durationOLD != default(float)) { diff --git a/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs b/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs index 66924f78..7bfa1faf 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/MenuTimer.cs @@ -11,7 +11,8 @@ namespace Fungus "Menu Timer", "Displays a timer bar and executes a target block if the player fails to select a menu option in time.")] [AddComponentMenu("")] - public class MenuTimer : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class MenuTimer : Command { [Tooltip("Length of time to display the timer for")] public FloatData _duration = new FloatData(1); @@ -60,10 +61,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (durationOLD != default(float)) { diff --git a/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs index 633f88ae..a85967b9 100644 --- a/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs +++ b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs @@ -8,7 +8,8 @@ namespace Fungus "Set Language", "Set the active language for the scene. A Localization object with a localization file must be present in the scene.")] [AddComponentMenu("")] - public class SetLanguage : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class SetLanguage : Command { [Tooltip("Code of the language to set. e.g. ES, DE, JA")] public StringData _languageCode = new StringData(); @@ -44,10 +45,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("languageCode")] public string languageCodeOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (languageCodeOLD != "") { diff --git a/Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs b/Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs index 900964a5..715ff921 100644 --- a/Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs +++ b/Assets/Fungus/Sprite/Scripts/Commands/FadeSprite.cs @@ -9,7 +9,8 @@ namespace Fungus "Fade Sprite", "Fades a sprite to a target color over a period of time.")] [AddComponentMenu("")] - public class FadeSprite : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class FadeSprite : Command { [Tooltip("Sprite object to be faded")] public SpriteRenderer spriteRenderer; @@ -72,10 +73,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD; [HideInInspector] [FormerlySerializedAs("targetColor")] public Color targetColorOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (durationOLD != default(float)) { diff --git a/Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs b/Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs index 41c369ae..0138246c 100644 --- a/Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs +++ b/Assets/Fungus/Sprite/Scripts/Commands/ShowSprite.cs @@ -9,7 +9,8 @@ namespace Fungus "Show Sprite", "Makes a sprite visible / invisible by setting the color alpha.")] [AddComponentMenu("")] - public class ShowSprite : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ShowSprite : Command { [Tooltip("Sprite object to be made visible / invisible")] public SpriteRenderer spriteRenderer; @@ -67,10 +68,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("visible")] public bool visibleOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (visibleOLD != default(bool)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs b/Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs index afd16d4c..b4d2de22 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/LookFrom.cs @@ -8,7 +8,8 @@ namespace Fungus "Look From", "Instantly rotates a GameObject to look at the supplied Vector3 then returns it to it's starting rotation over time.")] [AddComponentMenu("")] - public class LookFrom : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class LookFrom : iTweenCommand { [Tooltip("Target transform that the GameObject will look at")] public TransformData _fromTransform; @@ -57,12 +58,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD; [HideInInspector] [FormerlySerializedAs("fromPosition")] public Vector3 fromPositionOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (fromTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/LookTo.cs b/Assets/Fungus/iTween/Scripts/Commands/LookTo.cs index 3a2d743c..7918b7ae 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/LookTo.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/LookTo.cs @@ -8,7 +8,8 @@ namespace Fungus "Look To", "Rotates a GameObject to look at a supplied Transform or Vector3 over time.")] [AddComponentMenu("")] - public class LookTo : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class LookTo : iTweenCommand { [Tooltip("Target transform that the GameObject will look at")] public TransformData _toTransform; @@ -57,12 +58,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD; [HideInInspector] [FormerlySerializedAs("toPosition")] public Vector3 toPositionOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (toTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs b/Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs index a03a778c..295abc53 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/MoveAdd.cs @@ -8,7 +8,8 @@ namespace Fungus "Move Add", "Moves a game object by a specified offset over time.")] [AddComponentMenu("")] - public class MoveAdd : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class MoveAdd : iTweenCommand { [Tooltip("A translation offset in space the GameObject will animate to")] public Vector3Data _offset; @@ -35,12 +36,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (offsetOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs b/Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs index 34d5b4d0..1aa5e065 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/MoveFrom.cs @@ -8,7 +8,8 @@ namespace Fungus "Move From", "Moves a game object from a specified position back to its starting position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")] [AddComponentMenu("")] - public class MoveFrom : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class MoveFrom : iTweenCommand { [Tooltip("Target transform that the GameObject will move from")] public TransformData _fromTransform; @@ -46,12 +47,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD; [HideInInspector] [FormerlySerializedAs("fromPosition")] public Vector3 fromPositionOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (fromTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs b/Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs index 45e90864..84acc82b 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/MoveTo.cs @@ -8,7 +8,8 @@ namespace Fungus "Move To", "Moves a game object to a specified position over time. The position can be defined by a transform in another object (using To Transform) or by setting an absolute position (using To Position, if To Transform is set to None).")] [AddComponentMenu("")] - public class MoveTo : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class MoveTo : iTweenCommand { [Tooltip("Target transform that the GameObject will move to")] public TransformData _toTransform; @@ -46,12 +47,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD; [HideInInspector] [FormerlySerializedAs("toPosition")] public Vector3 toPositionOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (toTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs b/Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs index af66015e..ad20520d 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/PunchPosition.cs @@ -8,7 +8,8 @@ namespace Fungus "Punch Position", "Applies a jolt of force to a GameObject's position and wobbles it back to its initial position.")] [AddComponentMenu("")] - public class PunchPosition : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class PunchPosition : iTweenCommand { [Tooltip("A translation offset in space the GameObject will animate to")] public Vector3Data _amount; @@ -35,12 +36,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (amountOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs b/Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs index 38612bdd..bdefcd6b 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/PunchRotation.cs @@ -8,7 +8,8 @@ namespace Fungus "Punch Rotation", "Applies a jolt of force to a GameObject's rotation and wobbles it back to its initial rotation.")] [AddComponentMenu("")] - public class PunchRotation : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class PunchRotation : iTweenCommand { [Tooltip("A rotation offset in space the GameObject will animate to")] public Vector3Data _amount; @@ -35,12 +36,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (amountOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs b/Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs index 0bd3d4f9..7e859ce1 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/PunchScale.cs @@ -8,7 +8,8 @@ namespace Fungus "Punch Scale", "Applies a jolt of force to a GameObject's scale and wobbles it back to its initial scale.")] [AddComponentMenu("")] - public class PunchScale : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class PunchScale : iTweenCommand { [Tooltip("A scale offset in space the GameObject will animate to")] public Vector3Data _amount; @@ -31,12 +32,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (amountOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs b/Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs index f69939db..b0b4a5ac 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/RotateAdd.cs @@ -8,7 +8,8 @@ namespace Fungus "Rotate Add", "Rotates a game object by the specified angles over time.")] [AddComponentMenu("")] - public class RotateAdd : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class RotateAdd : iTweenCommand { [Tooltip("A rotation offset in space the GameObject will animate to")] public Vector3Data _offset; @@ -35,12 +36,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (offsetOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs b/Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs index c87df6bd..72f5ee95 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/RotateFrom.cs @@ -8,7 +8,8 @@ namespace Fungus "Rotate From", "Rotates a game object from the specified angles back to its starting orientation over time.")] [AddComponentMenu("")] - public class RotateFrom : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class RotateFrom : iTweenCommand { [Tooltip("Target transform that the GameObject will rotate from")] public TransformData _fromTransform; @@ -46,12 +47,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD; [HideInInspector] [FormerlySerializedAs("fromRotation")] public Vector3 fromRotationOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (fromTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs b/Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs index 9f516b8c..ac05a652 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/RotateTo.cs @@ -8,7 +8,8 @@ namespace Fungus "Rotate To", "Rotates a game object to the specified angles over time.")] [AddComponentMenu("")] - public class RotateTo : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class RotateTo : iTweenCommand { [Tooltip("Target transform that the GameObject will rotate to")] public TransformData _toTransform; @@ -46,12 +47,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD; [HideInInspector] [FormerlySerializedAs("toRotation")] public Vector3 toRotationOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (toTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs b/Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs index 53ac135a..b4d22500 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/ScaleAdd.cs @@ -8,7 +8,8 @@ namespace Fungus "Scale Add", "Changes a game object's scale by a specified offset over time.")] [AddComponentMenu("")] - public class ScaleAdd : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ScaleAdd : iTweenCommand { [Tooltip("A scale offset in space the GameObject will animate to")] public Vector3Data _offset; @@ -31,12 +32,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("offset")] public Vector3 offsetOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (offsetOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs b/Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs index beea48bf..5b2a7ba6 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/ScaleFrom.cs @@ -8,7 +8,8 @@ namespace Fungus "Scale From", "Changes a game object's scale to the specified value and back to its original scale over time.")] [AddComponentMenu("")] - public class ScaleFrom : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ScaleFrom : iTweenCommand { [Tooltip("Target transform that the GameObject will scale from")] public TransformData _fromTransform; @@ -42,12 +43,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("fromTransform")] public Transform fromTransformOLD; [HideInInspector] [FormerlySerializedAs("fromScale")] public Vector3 fromScaleOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (fromTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs b/Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs index 2a414f29..20851b50 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/ScaleTo.cs @@ -8,7 +8,8 @@ namespace Fungus "Scale To", "Changes a game object's scale to a specified value over time.")] [AddComponentMenu("")] - public class ScaleTo : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ScaleTo : iTweenCommand { [Tooltip("Target transform that the GameObject will scale to")] public TransformData _toTransform; @@ -42,12 +43,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("toTransform")] public Transform toTransformOLD; [HideInInspector] [FormerlySerializedAs("toScale")] public Vector3 toScaleOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (toTransformOLD != null) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs b/Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs index 658f29f2..dda2c07e 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/ShakePosition.cs @@ -8,7 +8,8 @@ namespace Fungus "Shake Position", "Randomly shakes a GameObject's position by a diminishing amount over time.")] [AddComponentMenu("")] - public class ShakePosition : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ShakePosition : iTweenCommand { [Tooltip("A translation offset in space the GameObject will animate to")] public Vector3Data _amount; @@ -50,12 +51,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (amountOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs b/Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs index 38dcefa9..d3591485 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/ShakeRotation.cs @@ -8,7 +8,8 @@ namespace Fungus "Shake Rotation", "Randomly shakes a GameObject's rotation by a diminishing amount over time.")] [AddComponentMenu("")] - public class ShakeRotation : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ShakeRotation : iTweenCommand { [Tooltip("A rotation offset in space the GameObject will animate to")] public Vector3Data _amount; @@ -35,12 +36,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (amountOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs b/Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs index b32248cd..127801a4 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/ShakeScale.cs @@ -8,7 +8,8 @@ namespace Fungus "Shake Scale", "Randomly shakes a GameObject's rotation by a diminishing amount over time.")] [AddComponentMenu("")] - public class ShakeScale : iTweenCommand, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class ShakeScale : iTweenCommand { [Tooltip("A scale offset in space the GameObject will animate to")] public Vector3Data _amount; @@ -31,12 +32,9 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("amount")] public Vector3 amountOLD; - public override void OnBeforeSerialize() - {} - - public override void OnAfterDeserialize() + protected override void OnEnable() { - base.OnAfterDeserialize(); + base.OnEnable(); if (amountOLD != default(Vector3)) { diff --git a/Assets/Fungus/iTween/Scripts/Commands/StopTween.cs b/Assets/Fungus/iTween/Scripts/Commands/StopTween.cs index 9b47d702..08180829 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/StopTween.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/StopTween.cs @@ -8,7 +8,8 @@ namespace Fungus "Stop Tween", "Stops an active iTween by name.")] [AddComponentMenu("")] - public class StopTween : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public class StopTween : Command { [Tooltip("Stop and destroy any Tweens in current scene with the supplied name")] public StringData _tweenName; @@ -23,10 +24,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("tweenName")] public string tweenNameOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (tweenNameOLD != "") { diff --git a/Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs b/Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs index 6035d267..77aba3d3 100644 --- a/Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs +++ b/Assets/Fungus/iTween/Scripts/Commands/iTweenCommand.cs @@ -13,7 +13,8 @@ namespace Fungus Z } - public abstract class iTweenCommand : Command, ISerializationCallbackReceiver + [ExecuteInEditMode] + public abstract class iTweenCommand : Command { [Tooltip("Target game object to apply the Tween to")] public GameObjectData _targetObject; @@ -98,10 +99,7 @@ namespace Fungus [HideInInspector] [FormerlySerializedAs("tweenName")] public string tweenNameOLD; [HideInInspector] [FormerlySerializedAs("duration")] public float durationOLD; - public virtual void OnBeforeSerialize() - {} - - public virtual void OnAfterDeserialize() + protected virtual void OnEnable() { if (targetObjectOLD != null) { @@ -113,7 +111,7 @@ namespace Fungus { _duration.Value = durationOLD; durationOLD = default(float); - } + } } #endregion