From 91e4487341079cdb8783085d0e2a396266b68caf Mon Sep 17 00:00:00 2001 From: nicloay Date: Sun, 8 Jun 2014 08:11:46 +0400 Subject: [PATCH] null reference exception if model doesn't have animation. --- .../UnitySpineImporter/Scripts/Editor/SpineImporterWizard.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/UnitySpineImporter/Scripts/Editor/SpineImporterWizard.cs b/Assets/UnitySpineImporter/Scripts/Editor/SpineImporterWizard.cs index 69ea5c7..82db06f 100644 --- a/Assets/UnitySpineImporter/Scripts/Editor/SpineImporterWizard.cs +++ b/Assets/UnitySpineImporter/Scripts/Editor/SpineImporterWizard.cs @@ -72,8 +72,9 @@ void OnWizardCreate(){ } ModelImporterAnimationType modelImporterAnimationType = getModelImporterAnimationType(); - SpineUtil.addAnimation(rootGO, directory, spineData, boneGOByName, attachmentGOByNameBySlot, - pixelsPerUnit, modelImporterAnimationType, updateResources); + if (spineData.animations !=null && spineData.animations.Count > 0) + SpineUtil.addAnimation(rootGO, directory, spineData, boneGOByName, attachmentGOByNameBySlot, + pixelsPerUnit, modelImporterAnimationType, updateResources); sk.showDefaulSlots(); SpineUtil.buildPrefab(rootGO, directory, name); GameObject.DestroyImmediate(rootGO);