浏览代码

Re-allow playing AnimatedSprite2D without frames

Fixes #47578, partial revert of #47064.
Rémi Verschelde 4 年之前
父节点
当前提交
77264e346b
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      scene/2d/animated_sprite_2d.cpp

+ 1 - 2
scene/2d/animated_sprite_2d.cpp

@@ -382,12 +382,11 @@ bool AnimatedSprite2D::_is_playing() const {
 }
 
 void AnimatedSprite2D::play(const StringName &p_animation, const bool p_backwards) {
-	ERR_FAIL_NULL_MSG(frames, "Can't play AnimatedSprite2D without a valid SpriteFrames resource.");
 	backwards = p_backwards;
 
 	if (p_animation) {
 		set_animation(p_animation);
-		if (backwards && get_frame() == 0) {
+		if (frames.is_valid() && backwards && get_frame() == 0) {
 			set_frame(frames->get_frame_count(p_animation) - 1);
 		}
 	}