Skip to content

Commit fa37717

Browse files
committed
fix(Util): Defense play once
1 parent 4df103e commit fa37717

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Assets/JCSUnity/Scripts/Util/JCS_Util.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,9 @@ public static AudioSource PlayClipAtPoint(
13121312
float volume,
13131313
float spatialBlend)
13141314
{
1315+
if (clip == null)
1316+
return null;
1317+
13151318
var gameObject = new GameObject("One shot audio");
13161319
gameObject.transform.position = position;
13171320
var audioSource = gameObject.AddComponent<AudioSource>();
@@ -1336,6 +1339,9 @@ public static ParticleSystem PlayParticleAtPoint(ParticleSystem ps, Vector3 posi
13361339
}
13371340
public static ParticleSystem PlayParticleAtPoint(ParticleSystem ps, Vector3 position, float duration)
13381341
{
1342+
if (ps == null)
1343+
return null;
1344+
13391345
ParticleSystem particleSystem = MonoBehaviour.Instantiate(ps);
13401346
particleSystem.gameObject.name = "One shot particle";
13411347
particleSystem.transform.position = position;

0 commit comments

Comments
 (0)