浏览代码

Fix CSGShape debug_collision_shape crash

Fixes CSGShape debug_collision_shape crash.

(cherry picked from commit 0cba21f2da096d9cc183fecf720fb9f83a9f37ba)
smix8 1 年之前
父节点
当前提交
611c435dab
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      modules/csg/csg_shape.cpp

+ 3 - 1
modules/csg/csg_shape.cpp

@@ -488,7 +488,9 @@ bool CSGShape3D::_is_debug_collision_shape_visible() {
 }
 
 void CSGShape3D::_update_debug_collision_shape() {
-	// NOTE: This is called only for the root shape with collision, when root_collision_shape is valid.
+	if (!use_collision || !is_root_shape() || !root_collision_shape.is_valid() || !_is_debug_collision_shape_visible()) {
+		return;
+	}
 
 	ERR_FAIL_NULL(RenderingServer::get_singleton());