0 votes

I'm getting an error:

Script inherits from native type 'RigidBody2D', so it can't be instanced in object of type: 'CollisionPolygon2D'

The line in queston is:

func createSubRock(res, pos, x, y):
var _rock = load(res)
var rock = _rock.instance()     -------- HERE!!!
rock.set_pos(Vector2(pos.x + x, pos.y + y))
rock.score = 75

On one machine, it works but on another, it stops. What am I doing wrong here?

asked Nov 11, 2017 in Engine by imekon (229 points)

Can you provide more information? Like:
Which Godot version are you using?
What are you trying to do?
Does the debugger/console say other things?
Im asking you because there can be more erros. Maybe Godot doesn't have admin permissions to write a file, or some methods changed in newer Godot versions

1 Answer

+1 vote

Oh dear, I've got my script attached to a CollisionPolygon2D node as well as RigidBody2d!

answered Nov 11, 2017 by imekon (229 points)
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 How to use this Q&A? before posting your first questions.