godotengine / godotengine/godot-docs

Disabling the CollisionShape2D in the editor drastically improves the loading time

Open
#11,522 2 comments 0 reactions 0 assignees View on GitHub
discussion topic:physics
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
Godot 4.5.1

**Issue description:**
I'm working on the project which loading **many CharacterBody2D** nodes which have **enabled** CollisionShape2D-s as the children in each one on the start of the game.

It was taking pretty long, but suddenly I've discovered for myself that if I will disable CollisionShape2D's in these CharacterBody2D-s in the editor and then will write in their `_ready` func
``` gdscript
$CollisionShape2D.set_deferred("disabled", false)
```
then everything will work as before(at least in my situation), but the loading time will be improved drastically(e.g. in the game itself it will be loading 2s instead of 20s).

I think that it's an important thing to note somewhere in the documentation as it's not that obvious but makes the loading of the games where are many CharacterBody2D on the scene on the start much more efficient.

I pin MRP in order you can ensure it yourself.
[cs2d_disabled_performance_boost.zip](https://github.com/user-attachments/files/24041065/cs2d_disabled_performance_boost.zip)

P.S. For the StaticBody2D it wasn't that noticeable, so I guess it isn't actual for this.

**URL to the documentation page (if already existing):**
Not sure it either should be CharacterBody2D or CollisionShape2D

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.