0 votes

I have wird problem in my project.
In a fact this happen from nowhere. Last time when I turn game on everything was fine and line: add_child(CollisionShape2D.new(), true) creates in my node tree CollisionShape2D (inside of KinematicBody2D). But right now i have this Errors:
enter image description here

in Engine by (227 points)

1 Answer

0 votes
Best answer

You might have run in a common mistake: http://docs.godotengine.org/en/latest/tutorials/2d/physics_introduction.html#collisionshape2d

CollisionShape2D is a helper node, meaning that it is meant to be used from the editor. In a script, you should create a Shape2D and use add_shape instead: http://docs.godotengine.org/en/latest/classes/class_collisionobject2d.html?highlight=add_shape#class-collisionobject2d-add-shape

by (28,972 points)
selected by

Before your answer I have create new project and right it's become to work again without any changes :/ You think it's can be a bug?

I have no idea tbh, just that CollisionShape2D is not meant to be created by script in a game. So it's possible some cases are even untested.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.