Godot Tidbits: Global Signals (Event Bus)

preview_player
Показать описание
Directly referencing children within a hierarchy gets cumbersome at scale, and Godot's signals work best within the local instance. When you start moving things around in the tree programmatically, or dynamically instantiating objects, it is handy to be able to emit a signal globally and have potential receivers "listen" to that signal wherever they may exist in the tree. This video goes over creating a centralized signal / event management system and using it for a few different scenarios.

Note to viewers: These tutorials take significant time & effort to create. If you got something valuable out of them, please like / subscribe so I know where to focus my efforts for future posts.
Рекомендации по теме
Комментарии
Автор

I've always connected to signals via the ready() function, and never bothered to disconnect them. Using the tree enter and exit is much cleaner, thanks for that tidbit.

Bargeral
Автор

this simplifies so much what the heck this is amazing

theonlybrowniee
Автор

What a glorious solution! I was having such a hard time understanding connecting signals in Godot and dreading the task, but now i see how simple it really is! This video should be linked in the documentation page for signals!

ckay
Автор

Phenomenal tutorial, exactly what I was looking for when handling signals with dynamically loaded objects! Very informative and straight to the point

Boblikescheese
Автор

Amazing tutorial. Global signals are something I’ve been trying to wrap my head around for a while (for making a bullet hell). and this does a good job explaining it.

EidoEndy
Автор

Excellent vidéo. Well explained. Thanks Mike !

RskSmiles
Автор

This was just what I was looking for! Thank you! I’ve been using an auto load with getters and setters which is working fine, but this will work a treat!

adrianmakes
Автор

amazing explanation. i stumbled upon a video on this topic and it hurt my brain. this one is super nice

drendelous
Автор

Thanks for this video. This drastically simplifies some of the things i wanted to do in Godot. Somehow i never considered using autoload for signals.

TheRythimMan
Автор

Thank you so much for making this! Super helpful and only one I could find that deals with dynamically loading objects. Update: watching this finally fixed a problem Ive been trying to resolve for a week of setting Z_Index of multiple instances of objects so that whatever the last clicked object was is on Z_Index 1 and everything else sets Z_Index to 0. Thank you!

donaldedgarvisuals
Автор

Bro, I hope you have a great day as well!

justsomedudewithadegree
Автор

Thank you for the beautiful and useful explanation.

Games-vunz
Автор

This guy needs more likes/subs this was great

brandonstone
Автор

Thanks, This is just what I was needing.

sestalacto
Автор

This is a great tutorial! Very underrated

avinsxd
Автор

Very interesting video i learned about the on scene enter and exit signals :D

MrGramno
Автор

4:51 it’s not random, it’s based on the scene save. So if you save a scene from within the script menu, and say are on a different script, that script you’re writing’s scene now becomes the original script’s scenes’s thumbnail.

Just go into the editor and re-save the scene with the area you want shown

ThaAftrPartie
Автор

To prevent a value going above the array length,
clampi(value, 0, array.size() - 1), using clampf if using float
To wrap it around:
value = (value + 1) % array.size()
or if it's a float
value = fmod((value + 1.0), float(array.size()))

rremnar
Автор

I would love to see a tutorial like this, but for a whole game!

steditionoutlet
Автор

Great video thank you! Also explained the Singleton thing. So we need to extend Node for our autoload Singleton? Does the autoload automatically get loaded in EVERY scene then?

grymmjack