Explorar o código

Make AnimatedSprite.animation complain when invalid animation name

(cherry picked from commit 2933ef42f791581c3109889ee002a8940685e608)
Mateus Felipe C. C. Pinto %!s(int64=6) %!d(string=hai) anos
pai
achega
8946ac9616
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      scene/2d/animated_sprite.cpp

+ 3 - 0
scene/2d/animated_sprite.cpp

@@ -645,6 +645,9 @@ void AnimatedSprite::_reset_timeout() {
 
 void AnimatedSprite::set_animation(const StringName &p_animation) {
 
+	ERR_EXPLAIN(vformat("There is no animation with name '%s'.", p_animation));
+	ERR_FAIL_COND(frames->get_animation_names().find(p_animation) == -1);
+
 	if (animation == p_animation)
 		return;