All Questions



Why not typing in some variables?

I noticed you don't use typing in some variables, for example in

var actions: Array

You could use typing in that as

export(Array, Resource) var actions
And also in same thing

export var actions = []

Could be turned into

export(Array, Resource) var actions

Those don't help a lot but still less clicking in editor, but then came in mind if there is something in Godot preventing to use typing in those?

  • GDQuestions replied

    What you're showing is not a type definition. Types are only defined with the colon. Above, the : Array part is a type definition.

    Sure, you can use an export hint to make your life a little easier with the Inspector in Godot. We could add that. It only tells the editor what to accept when doing drag and drop or clicking the feature.

    As for why we don't have that: ultimately, in Godot 3, you don't want to work too much with exported arrays. I don't remember if I mention this in the course, but the idea is early on you'd want to make some editor plugin or use some tool to edit your game's data without going through the Inspector. Otherwise, it's gonna get slow and frustrating.

    In Godot 4 the situation should be much better with actual typed arrays and a much better interface to edit arrays in the Inspector. I can't wait for us to have that!

  • a
    ama replied

    Ah yeah that was hinting but anyways.

    And yeah as I'm doing this I feel urge to write some plugins to make things simpler, for example for attacks and status effects (now in that stage).

    Best thing they could do for arrays or Resource type is to put on beginning that `Quick Load` and `Load` buttons, and not last.

  • GDQuestions replied

    Yes absolutely, a plugin is a must for this kind of project. There are some out there, I believe, that allow you to edit tables of arbitrary resources already. That'd be a start. Otherwise, there are engine-agnostic programs like CastleDB.