An Actual Typhoon

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

Adding PressurePlate.tscn to the Obstacles node prevents the ObstacleCourse scene from running, opens PressurePlate.gd in the Script editor, and generates this message:
Script inherits from native type 'Area2D', so it can't be instanced in object of type: 'YSort'.

PressurePlate.tscn works fine in a separate test scene with doors, as do other scenes when run individually.

There's something about the interaction of the PressurePlate.gd's "extends Area2D" line that the Course.gd or ObstacleCourse.gd YSort node doesn't like, but I don't know why it causes problems in my version and not the one in the lesson.

The ObstacleCourse scene will now no longer run, even after deleting all instances of PressurePlate.tscn from the ObstacleCourse scene; it generates the above message. 

  • FATNUT replied
    Solution

    Can you make sure the node you attached the script to, matches the type you are extending?
    So your PressurePlate.tscn might have the script attached to the incorrect node, therefore it can't inherit properly.


    Example:
    The green boxes show you an incorrect type extension, as one is a Node2D and the other is a CollisionShape2D.
    You either have to change the scripts location (blue box), extend a different type or change the Nodes type.

    1 love
  • Nathan Lovato replied

    Thanks for taking the time to help, FATNUT!

    1 love
  • An Actual Typhoon replied

    Thank you! Working backwards from your solution, I find that I must have accidentally dragged a script instead of a scene onto my Obstacles node!

    It is good to know that mismatched types will cause this kind of problem.

    1 love