From dce46e416b005225d062778915056678e0e7ebef Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Mon, 25 May 2015 21:04:28 +0100 Subject: [PATCH] Adding Set Draggable command causes null exception error #111 Fixed a second bug around tags --- .../Sprite/Scripts/Commands/SetCollider.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Assets/Fungus/Sprite/Scripts/Commands/SetCollider.cs b/Assets/Fungus/Sprite/Scripts/Commands/SetCollider.cs index 252a004f..a5fefe12 100644 --- a/Assets/Fungus/Sprite/Scripts/Commands/SetCollider.cs +++ b/Assets/Fungus/Sprite/Scripts/Commands/SetCollider.cs @@ -26,10 +26,22 @@ namespace Fungus SetColliderActive(go); } - GameObject[] taggedObjects = GameObject.FindGameObjectsWithTag(targetTag); - foreach (GameObject go in taggedObjects) + GameObject[] taggedObjects = null; + try { - SetColliderActive(go); + taggedObjects = GameObject.FindGameObjectsWithTag(targetTag); + } + catch + { + // The tag has not been declared in this scene + } + + if (taggedObjects != null) + { + foreach (GameObject go in taggedObjects) + { + SetColliderActive(go); + } } Continue();