Просмотр исходного кода

Fixed GameAction not playing SFX clips

James Peret 2 лет назад
Родитель
Сommit
65bb9f7762
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      Runtime/GameActions/PlaySFXClipGameAction.cs

+ 5 - 2
Runtime/GameActions/PlaySFXClipGameAction.cs

@@ -56,11 +56,14 @@ namespace KairoEngine.SFX.GameActions
 
         public override void Start()
         { 
+            Debug.Log("Playing sound");
             GameObject parentObj = GetVariable<GameObject>(parent, null);
+            Transform parentTransform = null;
+            if(parentObj != null) parentTransform = parentObj.transform;
             Vector3 pos = new Vector3();
             if(parentObj != null) pos = parentObj.transform.position;
-            if(librarySfxClipName != null) SoundController.EmmitSound(librarySfxClipName, pos, parentObj.transform);
-            else if(sfxClip != null) SoundController.EmmitSound(sfxClip, pos, parentObj.transform);
+            if(sfxClip != null) SoundController.EmmitSound(sfxClip, pos, parentTransform);
+            else if(!string.IsNullOrEmpty(librarySfxClipName)) SoundController.EmmitSound(librarySfxClipName, pos, parentTransform);
             _done = true;
             _started = true;
         }