Signals in Godot are Amazing!

preview_player
Показать описание

In this video I show you the fundamentals of using signals in Godot. I will give you some Godot tips and trick to help you improve your use of Godot signals.
Signals in Godot are truly amazing!
In Godot, Signals allow the nodes in your scene to easily communicate with each other without requiring a direct reference to one another. You can do some seriously amazing thing in the godot game engine. And in the new Godot 4 signals have become even better. So sit back and learn all that they can do.

My Set Up:

As an Amazon Associate I earn from qualifying purchases.
---------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------
Please like and Subscribe! It's truly appreciated

#GameDevelopment #GameJam #Godot

Links to my Socials

Рекомендации по теме
Комментарии
Автор

What Feature should I cover next! Comment Down below and I'll the most liked one!

Chaff_Games
Автор

Regarding your last cable metaphor, Id say a signal is more like yelling from one room, and someone listens in another. You dont really care who listens and dont have a specific cable going there. Whereas a function/method with a known reference is like the cable, having a set start and end point that can be traced.

infinitenex
Автор

I come from Roblox Studio so I know just how crazy good events are, but making them in Godot is much easier and more intuitive once you get it. Thanks for showing this!

tomsterbg
Автор

NGL that was exactly what I wanted and I'm so glad you uploaded this video, thanks a lot.

My suggestion for the next video would be Control nodes, the way they scale is confusing as hell.

giorgimaisuradze
Автор

Problem with signals is I need to know what node I am connecting to. At that point it is a glorified list on the main object that has a bunch of delegates. I would rather have a static or global list that I can subscribe where ever and have no care in the world who calls it.

Cadaverine
Автор

Having switched from BO3 modding, moving to singleton function libraries & storage in Godot, to now getting serious with signals, I'm definitely a bit surprised the concept of a 'global event bus' isn't implemented by default, at least to my knowledge.

BO3's version of a signal system (notify (the signal event), endon (end current function if node receives specified signal), & waittill (allow node to resume upon signal if waiting)) one is able to specify things like "level waittill(<signal>, [sender_capture]);", & "level notify(<signal>);" as opposed to self / specific_object waittill(<signal>, [sender_capture]);" and "that_specific_object notify(<signal>);" respectively. Cross-node, cross-script, no outright defining functions or receivers at all. Just single-line notifications.

Edit: Where Godot's signal system may be connecting cables to & from defined ends, BO3's has the additional ability to be a bunch of vague people standing in various rooms & one guy yells, alerting everyone who was told to stand in that room & it'd be pog if this could become a standard reality in Godot, as great as it is.

Niknokinater
Автор

I had major Déjà vu just watching the first 15 seconds of this video.

RedEyedJedi
Автор

I think the most convenient way of using signals is to have the signals be emited from an autoload. Let's say the autoload is called Sgn. If player got damaged, the player it will emit a signal like Sgn.emitsignal("healthchanged", new_health). The health bar which could be anywhere in the Hud scene structure can connect to the signal and work as intended.

DileepNow
Автор

I dislike the hype that signals get. I'd rather use global variables. It is extremely rare the cases where I need to use a custom signal.
Example, you hit the target and need to notify the UI.
There is only one UI in the game, I have the UI declare itself as the only UI on the game, so in it's "_ready" function we have "Globals.ui = self".
Then the bullet hits the target, when the bullet enters the body I call right there:



It's that simple. There's no get_node(../) shennanigas. There's no declaring a signal. There's no signal emit. There's no signal connect.

luism
Автор

Question, Sensei ☝️
You said signal is the way nodes to communicate to each other without reference, but from very little thing I know as we try to connect to emitted signal, we still need to write the "connect" using the emitter name, for example:
Head Node(Emitter)
Signal took_damage(amount)
emit_signal("took_damage", 999)

Body Node(Listener)
onready var head_node = "head_node path"

func _ready():
name), self(target), "calculate_damage"(function that reacts to the signal))

Or did I miss something?
Please, answer 🙏

agriasoaks
Автор

Just found your channel, great reasource for those learning godot :)
Little editing glitch at the start with the repeated line but overall great

DillBee
Автор

I don't quite understand what do you mean by you don't need a reference to a specific Node to connect the signal.

Kinda yes... You don't need in the code. But you still need a reference through the signals inspector.

Anyway you bind together two entities. Yes, not through the code but they are still bind together through Godot.

I though the idea of signals is that some entity creates signal and all other entities can just subscribe to signal through some abstraction. I mean without binding anything anywhere. One entity invokes signal and the other listens to it by the signal name or id or something.

mykytamarkianov
Автор

Is it possible to send a signal to a node in another scene?

malsypright
Автор

I like this video for showing what it can do... but it would be better if it showed how to do it more in depth.

shanefoster
Автор

signals more like Sometimes I want to bang my head to the wall 😩 every single time I made one it get even worse and more complex 😭

Soroosh.S
Автор

When I saw
signal ...
signal ...
signal ...
signal ...
signal ...

signal ...
signal ...
signal ...
signal ...
signal ...
signal ...

at the top of the code file, I started to have ~questions~ lol

sibotime
Автор

I hate that they implemented them with strings. So much unnecessary overhead, if you use alot of signals and it is just stupid.

sainteven
Автор

This seems unnecessarily painful imo. Perhaps I just got to get used to it.

Assortment
Автор

Honestly, signals are the one thing that I think are a downgrade since moving from Unity. There's still coupling between nodes because either doing through the inspector requires you to have both nodes in the same scene, or doing it from code requires a hard reference to the emitter. Back in Unity, you simply have an object emit an event, and other objects just subscribe to the events without any referencing to the emitter.

gonderage
Автор

After the whole unity mess up, I tried to go and I found signals to be just the dumbest thing I've ever seen in a program in language. I mean, why would you need something like a signal to connect notes together? Why can't you put multiple script on one note? If you wanna do that cause essentially the way it was explained to me. Is that signals baseline? Make it so nodes can have access to Gd script. The other notes have connected to them. It's very confusing, especially for beginners and like I said, higher level. Programming languages like C-sharp and c plus plus in their perspective. Game engines, you just write another script and just attach it to the game object. I mean, it's done, it doesn't have to be yo. It's difficult to get a game object to move or do something. Buy beer and I'll just write another script so I don't get the whole y Gd scripted. Hawaiian gymnastics and good. Those things that are so great to have these signals everywhere.
I don't know, baby. I'm missing something or if. It's something that you know.Maybe I just don't understand but I literally have tried and tried to understand what these things do and why we need them and from what I can tell.It's only because of g d script incapability of attaching multiple scripts to a node

davestomper