瀏覽代碼

Move the shape test to a little sooner

George Marques 10 年之前
父節點
當前提交
5ff0b69dae
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      scene/2d/collision_shape_2d.cpp

+ 4 - 3
scene/2d/collision_shape_2d.cpp

@@ -113,13 +113,14 @@ void CollisionShape2D::_notification(int p_what) {
 				break;
 			}
 
+			if (!shape.is_valid()) {
+				break;
+			}
+
 			rect=Rect2();
 
 
 			Color draw_col=get_tree()->get_debug_collisions_color();
-            if(!shape.is_valid()) {
-                break;
-            }
 			shape->draw(get_canvas_item(),draw_col);