Bug "Script inherits from native type "RigidBody2d", so it can't be assigned to an object of type: "Node2d" but the node is an "RigidBody2d"

4.2.2 stable

Bug "Script inherits from native type “RigidBody2d”, so it can’t be assigned to an object of type: “Node2d” but the node is an “RigidBody2d”

At first i had couple of errors but when i tried to fix them this one appeared and currently this is the only error.

The script is attached to object “Element”



Ekran görüntüsü 2024-07-15 200257

if i misspelled something sorry

Are you sure it’s a RigidBody2D? The inspector may give better hints to this. Could this script be applied to another Node elsewhere?

interesting, how does it break the code?

No, i am sure. When i click on to the script button next to node “Element” the script “Element” shows up. And just tried this, when i change the type of the node it doesn’t give that error but breaks the whole code.

It gave errors in the freeze toggling section an some things like that but i cant recreate the error now it just says Script inherits from native type “RigidBody2d”, so it can’t be assigned to an object of type: “Node2d” but the node is an “RigidBody2d

@system what is this

Paste your .tscn file

1 Like

I have solved it. The script “Element” was used by both the scene “Element”(is rigidbody2d) and the scene “Main”(is node2d) and that coused it. I just made the script “Element” only used by the scene “Element”. That solved it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.