All Questions

Community

D
Gonsen

Incorrect text

It says to create a new node of type BlueprintEntity, but we didn't create it. What we did create instead is just a class BlueprintEntity. The text is the following:

We can now create the StirlingEngineBlueprint scene. It should have a BlueprintEntity node named StirlingEngineBlueprint as its root and a Sprite as a child of it. We can directly create a node of type BlueprintEntity because we defined the class name above.

  • Nathan Lovato replied
    Solution

    The text is correct. When you define a class in GDScript if you search for Blueprint in the Add Node menu, you'll see your new type appear.

    It's one of the reasons to write class names: they register as new node types in the editor.

    If it doesn't appear, double-check you saved your script, and if it still doesn't work, try to restart godot. Might be some cache that didn't update right. But normally it should be registered as soon as you save your script.

  • D
    Gonsen replied

    Oh right, and because the script extends Node2D we can see it in the menu and add it as a node.

    I just had a problem regarding this, the game would crash when adding the blueprint to the world because was trying to convert a Node2D type to a BlueprintEntity.gd type.

    var _blueprint: BlueprintEntity

    But mine wasn't a BlueprintEntity, was Node2D, that's why it crashed.

    Thank you very much!

  • Nathan Lovato replied

    You're welcome!