From 507b2ce8e069ed105bb9bc6ac59a5aba39022750 Mon Sep 17 00:00:00 2001 From: craftwill Date: Sun, 27 Oct 2024 15:57:26 -0400 Subject: [PATCH] Null check so that buildings dont need an animator --- Assets/Scripts/AnimationEntity.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/AnimationEntity.cs b/Assets/Scripts/AnimationEntity.cs index e2018b7..63359d8 100644 --- a/Assets/Scripts/AnimationEntity.cs +++ b/Assets/Scripts/AnimationEntity.cs @@ -78,8 +78,13 @@ public class AnimationEntity : MonoBehaviour public void PlayDieAnim() { - _animatorEntity.speed = 1; - _animatorEntity.Play("die", 0, 0f); + // Not every entity needs an animator + if (_animatorEntity != null) + { + _animatorEntity.speed = 1; + _animatorEntity.Play("die", 0, 0f); + } + entityState = EntityAnimationState.Dying; _doSomething = true; _isDead = true;