Show an error when setting a negative size on a collision shape

This commit is contained in:
Aaron Franke 2022-02-20 00:37:49 -06:00
parent 499eec13a3
commit 9f048f4c4d
No known key found for this signature in database
GPG key ID: 40A1750B977E56BF
7 changed files with 10 additions and 0 deletions

View file

@ -58,6 +58,7 @@ bool RectangleShape2D::_get(const StringName &p_name, Variant &r_property) const
#endif // DISABLE_DEPRECATED
void RectangleShape2D::set_size(const Vector2 &p_size) {
ERR_FAIL_COND_MSG(p_size.x < 0 || p_size.y < 0, "RectangleShape2D size cannot be negative.");
size = p_size;
_update_shape();
}