Преглед на файлове

Make AnimatedSprite.animation complain when invalid animation name

Mateus Felipe C. C. Pinto преди 6 години
родител
ревизия
2933ef42f7
променени са 1 файла, в които са добавени 3 реда и са изтрити 0 реда
  1. 3 0
      scene/2d/animated_sprite.cpp

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

@@ -632,6 +632,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;