gasilgt.blogg.se

Godot signals
Godot signals






godot signals

Godot signals code#

However, for the person on a programmer role, making connection from code is more flexible (they have more control over when the connection happens, and can be made to node created from code). Also connections made on the IDE give flexibility to the designer (they can be connected in different ways to fit the needs of the game or scenario). The person on a designer role can rely on the connections made on the IDE to be there (they are persisted, and are made effective early when loading the nodes). For the purposes of this answer, let us say that the programmer is creating the pieces that come together to make the game, and the designer is placing those pieces together. The distinction I want to make is on the kind of problems being solved. The designer and the programmer can be the same person, taking both roles. If anything using the IDE will favor a designer workflow over a programmer workflow. And a similar intuition would apply to connecting signals.

godot signals

The intuition is that you make in from code if it is dynamic. We could similarly ask what is better between creating nodes from code on creating them in the IDE. They serve different purposes, and there are gray areas. I will echo that there is no "better" way. Otherwise, convenience triumphs, which I guess means connecting from IDE. Not on a reusable asset: If you have one of the reasons to connect from code, then connect from code. No: Connect from the IDE (giving the flexibility to the designer), unless you have one of the reasons above for the asset to connect from code. Should the connection always be there for the asset to work? Yes: Connect from code.Are you writing GDScript? No: Connect from code, or use GDScript as glue.Should the connection include a node made on runtime? Yes: Connect from code.Should the connection be removed on runtime? Yes: Connect from code.Should the connection happen on load? No: Connect from code.Should the connection be persisted? No: Connect from code.








Godot signals