Overview
Area2DGameObject is a game object introduced in version 1.2.0. Compared to the traditional GameObject, it reduces runtime overhead by omitting features related to physical collisions.
Since physical collisions are not supported, it is unsuitable for characters such as players or enemies (which would cause issues if they could pass through walls), or for destructible walls and other objects serving as character obstacles. However, replacing objects that do not require physical collisions with Area2DGameObject can effectively reduce the overall processing load of the game.
Technical Overview
The traditional GameObject is a custom node inheriting from the CharacterBody2D node, while Area2DGameObject, as its name suggests, is created by inheriting from the Area2D node.
For detailed differences between these nodes, please refer to the following manual:
Features Unavailable Due to Lack of “Physical Collision”
Due to the absence of physical collision support, the following behaviors cannot be implemented:
- Cannot collide with other objects.
- Cannot move along the shape of the ground or walls, nor slide on slopes.
- The “Bounce Movement” and “Won’t Fall from Heights” features in template movement actions will not function.
For properties that do not work in Area2DGameObject, the system will display warning notifications.
Features Still Available Without “Physical Collision”
- Contact detection with other objects is still possible, so contact-based conditions such as wall detection will function normally.
- Gravity still affects the object.
You can think of it as a sensor: no physical collision, but detection is still possible. Essentially, all features except those listed under “Unavailable Features” above will work normally.
By setting behaviors such as “When touching a tile” and “Set movement speed to 0” in visual scripting, pseudo-collision handling can be achieved. For example, you can simulate the effect of items scattering after an enemy is defeated. However, since this is merely simulated processing, the likelihood of object overlap or similar issues increases—please exercise caution.
How to Use Area2DGameObject
Area2DGameObject is compatible with existing GameObjects. Simply right-click the GameObject node and select “Change Type” to switch it to Area2DGameObject.
Similarly, you can use the same method to switch Area2DGameObject back to GameObject.