From d9ef7ce9befe7196796585e553b52dec3be0c9f3 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Fri, 21 Nov 2014 15:16:18 +0000 Subject: [PATCH] Fixed null reference when adding new iTween commands --- Assets/Fungus/iTween/Commands/iTweenCommand.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Assets/Fungus/iTween/Commands/iTweenCommand.cs b/Assets/Fungus/iTween/Commands/iTweenCommand.cs index cd146051..79ddfa0c 100644 --- a/Assets/Fungus/iTween/Commands/iTweenCommand.cs +++ b/Assets/Fungus/iTween/Commands/iTweenCommand.cs @@ -14,7 +14,7 @@ namespace Fungus public abstract class iTweenCommand : Command { [Tooltip("Target game object to apply the Tween to")] - public TargetObject targetObject; + public TargetObject targetObject = new TargetObject(); [Tooltip("An individual name useful for stopping iTweens by name")] public string tweenName; @@ -66,14 +66,12 @@ namespace Fungus public override string GetSummary() { - string targetSummary = targetObject.GetSummary(); - - if (targetSummary == null) + if (targetObject.targetType == TargetObjectType.Other && targetObject.otherGameObject == null) { return "Error: No target object selected"; } - return targetSummary + " over " + duration + " seconds"; + return targetObject.GetSummary() + " over " + duration + " seconds"; } public override Color GetButtonColor()