All Questions

Community

Daniel Queiroz Porto

Is there any problem in casting for autocompletion?

On a line like: `onready var state : State = get_node(initial_state) setget set_state` we don't get auto-completion on state even though we set the variable type, so sometimes I also cast it at the assignment like this: `onready var state : State = get_node(initial_state) as State setget set_state` Then I get auto-completion throughout the code. Is that okay? Does it have any bad side effects or is it a bad practice?
  • Nathan Lovato replied

    Casting probably has a [really] small impact on performances, but it's fine to use it. Godot 3.2 should fix this missing autocompletion issue when it's out - I tested development builds and the script editor is much better. 🙂

  • Daniel Queiroz Porto replied

    Oh, that's Cool! Thanks for the reply!