How To Use Signals In Godot 4

Sdílet
Vložit
  • čas přidán 22. 08. 2024

Komentáře • 74

  • @khlobbia
    @khlobbia Před 8 měsíci +104

    You sound like you were held at gunpoint and told "explain the basics of signals in Godot in a clear and simple manner within 5 minutes." Great video.

    • @notwinston6009
      @notwinston6009 Před 15 dny +1

      As it should be. Concise, factual, with relatable examples.

    • @JasonEllingsworth
      @JasonEllingsworth Před 6 dny

      I thought he was going way too fast, but I have the personal opinion that this is beginner level stuff that should be taught properly. This guy is clearly not a teacher, and probably on Ritalin. I can slow it down obviously, but it sounds terrible.

  • @TheFilipFonky
    @TheFilipFonky Před měsícem +8

    Thanks. All the other tutorials have a lot of "let's make a billion unrelated things and then there's a signal in the middle, watch out for that" bs

  • @slephy
    @slephy Před 9 měsíci +14

    Finally a no-fluff explanation with practical examples and an avoidance of standardized naming conventions. Thank you!

  • @xshad3x348
    @xshad3x348 Před rokem +23

    Basically signals are "events" triggered by actions and you "listen" to them with listeners (connect), and callables are basically "closures". I come from a web background in JS :)

  • @tristangillis7365
    @tristangillis7365 Před 8 měsíci +5

    I've seen like eight different videos about signals, and this is the first one that actually explains what the callables are. THANK YOU.

  • @mr_sauce_cooks
    @mr_sauce_cooks Před rokem +9

    Hey thank! This by far the most coherent tutorial others just keep talking about built-in one and rarely give any examples for costume signals

  • @CyricRO
    @CyricRO Před 10 měsíci +8

    Fast, informative, straight to the point. Thank you!

  • @finnja3176
    @finnja3176 Před 4 dny

    after an hour or so this is the only video that worked. Thanks!

  • @Slipy61
    @Slipy61 Před 4 měsíci +3

    Wow, you actually got through to me after about a dozen videos explaining signals. I think you naming them silly things actually helped, cause naming them something useful in tutorials makes me feel like that custom name is supposed to mean something X)

  • @kevinw4461
    @kevinw4461 Před rokem +5

    Dude great video one of the very few that explains it simply and clearly

  • @yoush2256
    @yoush2256 Před rokem +20

    Good video nad labs :)
    I think "function as a variable" would be a better simplified definition of a callable. The reason Godot 4 signals have changed from 3 is because Functions are now first-class. This means they're a Class (Callable) and can be assigned to variables and passed into functions like any other class (rectangle, sprite, Vector, or any other Node).
    Also it's preferable to use the reversed Godot 4 syntax of Object.signal.connect(Function:Callable) and signal.emit() to reduce the use of strings and actually take advantage of the first--class nature, iirc the syntax you're using is just a hold-over from 3.x
    Also also, if the function is simple enough, you can pass in an anonymous/lambda function instead of the name. This is good if you only use the function in one place and don't want to write it out somewhere else
    signal.connect(func(): print('hello world')) or something like that
    absolutely shivering in anticipation for the next vid 😳

  • @randomnumbers84269
    @randomnumbers84269 Před 9 měsíci +2

    So far you're the only channel which explains this the right way it should be used: via the code and not through the editor.

  • @MohamedMagdy-eb9xq
    @MohamedMagdy-eb9xq Před 3 měsíci +1

    Thank you so much for this clear and simple explanation , That video is so underrated and it deserves a lot more likes.

  • @vegasdealer777
    @vegasdealer777 Před 11 měsíci +3

    I watched somebody else's signal video that was 2 years old. I kept getting errors. It wasn't Godot 4. Duh. After watching your video, it's all good now! Thanks!

  • @calebernst8025
    @calebernst8025 Před 6 měsíci

    Thank you! You have no clue how many hours I've been trial-and-erroring signals until this video

  • @MH-lr6ue
    @MH-lr6ue Před 4 měsíci

    This video is getting me closer to understanding! Thanks for this.

  • @planktongunslinger5730
    @planktongunslinger5730 Před 11 měsíci +3

    Thanks for this video. Pretty coherent and takes the time to explain all the major concepts

  • @tsuki0sm4nthus
    @tsuki0sm4nthus Před měsícem +1

    simple and straightforward, noice

  • @EthanLR
    @EthanLR Před 4 dny

    Brilliantly explained, appreciate the concise tutorial

  • @utilityy
    @utilityy Před rokem +1

    Oh, nice! That's a really nice way of communicating between parent and child nodes :O
    Also, I absolutely love your enthusiasm and the way you teach. Great stuff!

  • @NoTAdrian115
    @NoTAdrian115 Před 2 měsíci +1

    This really helps a lot, thanks mister.

  • @Itual
    @Itual Před 13 dny

    I don't know why but this tutorial felt so... agressive? It was very useful though, everything was quite easy to comprehend and it helped me.

  • @chase7767
    @chase7767 Před 8 měsíci +1

    "I know custom signal sounds scary but it's not" XD

  • @Yensnor
    @Yensnor Před 6 měsíci +1

    Best explanation i've heard so far, thank u 🙏

  • @adwilson0286
    @adwilson0286 Před 8 měsíci +1

    Excellent video! Exactly what I needed to learn about hooking up signals.

  • @ddrlear
    @ddrlear Před 7 měsíci +1

    The talking a mile a minute was actually a nice contrast to some of the slow tutorials I've seen. Also, the oogaboogafunction had me dying.

  • @wabux.official
    @wabux.official Před 6 měsíci +1

    amazing and short 🙏thank you again

  • @Crisisdarkness
    @Crisisdarkness Před rokem +4

    well done, but I would like to know how I can connect a signal to another node, through code, in your case, you call a function located in the same script, I would like to point to another target (that when you are connecting, you are connecting to another node, to call a function of that node), how can I do that?, in godot 3 I knew how to do it, but here it has changed

    • @15plus1
      @15plus1 Před 11 měsíci +1

      Did you find a solution so far? I´m still looking for one ...

    • @Crisisdarkness
      @Crisisdarkness Před 11 měsíci

      @@15plus1 Yes, but try to tell me what is your problem, what do you want to connect, and I will try help you. Tell me the node you want to connect to the other node (both names)

  • @gavindunlap4195
    @gavindunlap4195 Před 9 měsíci

    This guy would teach you math and insult you so you remember love it

  • @MadeFromScratchMFS
    @MadeFromScratchMFS Před 3 dny

    Thank you very much, this was very very useful.

  • @orlandocabrera8232
    @orlandocabrera8232 Před 9 měsíci +1

    that was an amazing speedrun

    • @NADLABS
      @NADLABS  Před 9 měsíci

      This is the best insult and compliment ever 💀

  • @evilferber2704
    @evilferber2704 Před rokem +1

    Thank you! Very helpfull to fully understand signals :)

  • @fenveer
    @fenveer Před 10 měsíci +1

    Dudes going places, keep it up!

  • @thelastoneee3741
    @thelastoneee3741 Před 9 měsíci

    Thank you, late night understandings

  • @dips_modding
    @dips_modding Před 8 měsíci +1

    Fantastic video

  • @thvist
    @thvist Před 2 měsíci +1

    Great video!

  • @mutantramen
    @mutantramen Před 8 měsíci +1

    insanely helpful, thank you!!!

  • @Vaibhavsingh-yc5ln
    @Vaibhavsingh-yc5ln Před 2 měsíci +1

    that, was amazing

  • @sebashtioon_
    @sebashtioon_ Před 4 měsíci

    You the goat. Thanks bro

  • @Yuri-np5ru
    @Yuri-np5ru Před 7 měsíci

    most excellents, many thanks, good sir

  • @szccornish8034
    @szccornish8034 Před 10 měsíci +1

    finaly i understand

  • @Vilithos
    @Vilithos Před 2 měsíci +1

    Godot 4 Signals [Speedrun WR]

  • @D.E.Nicolas.Goncalves
    @D.E.Nicolas.Goncalves Před 8 měsíci +1

    Extremely Valuable!

  • @bill_makes_games
    @bill_makes_games Před rokem

    Great video, right to the point as always 🙂

  • @KekLuck
    @KekLuck Před rokem +4

    The only thing I dont get:
    Couldnt the area also call get_parent().asdf()
    Why is there a need to be a signal? Is there any advantage other than signals dont crash on "null" errors?
    I agree the area could have a parent that doesnt have an asdf() function, but if my game has that for sure is there any other benefit?

    • @cullsans
      @cullsans Před 9 měsíci

      Signals help keep code modular so like you said, if you are certain your structure won't change then it may not be the best use case for signals. I think signals are best utilized when two or more nodes are connected or if you want to account for nodes being there sometimes but still connect seamlessly to the code.

  • @cholasimmons
    @cholasimmons Před 2 měsíci +1

    Subscribed! 😎😎

  • @vegasdealer777
    @vegasdealer777 Před 10 měsíci +1

    I just noticed something and I have a question. The 4th time the OogaBoogaFunction is called, it sometimes doesn't print the mouse entered/global mouse position line before the program exits. And then sometimes it does. I wrote a version of this exercise where I had a 'print("Destroyed!")' line in the asdf function just before the 'get_tree().quit()' statement. And sometimes it would show. Other times it wouldn't. The execution sometimes jumps ahead to the 'get_tree().quit()' before the printing happens.
    How would you prevent that, I wonder? Anyone's comments would be welcome. Thanks.

  • @blackfun4448
    @blackfun4448 Před 6 měsíci

    ty for great video

  • @Gr3nMaster
    @Gr3nMaster Před měsícem +3

    "ogabooga" is the best example I could've asked for.

    • @NADLABS
      @NADLABS  Před měsícem

      And that’s why I do it like that

  • @AtomicTocomple
    @AtomicTocomple Před 7 měsíci +1

    blink twice if you are ok

  • @coffeenightmare4289
    @coffeenightmare4289 Před měsícem +1

    thx

  • @WuCSquad
    @WuCSquad Před 10 měsíci +1

    Nice, thanks!

  • @Soroosh.S83
    @Soroosh.S83 Před rokem +1

    it was awesome
    here me out best signal tutorial for godot 4 it's latest and up to dated 🙌

  • @alluja
    @alluja Před 10 měsíci +1

    counterpoint: there is no counterpoint

  • @surferriness
    @surferriness Před 9 měsíci +2

    i love you

  • @randomnumbers84269
    @randomnumbers84269 Před 9 měsíci +1

    How do I do this between scenes?

  • @renallen7551
    @renallen7551 Před 8 měsíci

    I really don't understand.
    Although I do as I was told in the video, if I type in the 2nd script:
    $Character.connect("damagePlayer", self, calculateDamage)
    The error that appears is:
    *Unexpected "$" in class body*
    The only thing I want is to send the damage value that Character has to the enemy. How should I actually use the signals?

  • @SunJaycy
    @SunJaycy Před 5 měsíci

    slow down bro, we get it you have experience

  • @FateflyYip
    @FateflyYip Před 3 měsíci

    extends Area2D
    func _ready() -> void:
    connect("body_entered", sword_hit.bind(body))
    func _process(delta):
    pass
    func sword_hit(body):
    emit_signal("hit", body)
    I have this script where i wanted to connect area2d body_entered signal to a defined func called sword_hit , but i need the body attached to it. So the body can be pass to another signal called `hit`.
    this is the error i met, `Line 4:Identifier "body" not declared in the current scope.`
    Please help Q_Q

  • @quickblack
    @quickblack Před 5 měsíci

    can you make tutorial to pass variable through signal?

  • @davijose2462
    @davijose2462 Před 8 měsíci

    Newbie question. Whydont call a function inside world as get_node?

  • @randomnumbers84269
    @randomnumbers84269 Před 9 měsíci

    What does the "-> void" do?

  • @xsltd
    @xsltd Před rokem

    Goated

  • @theoomslayer
    @theoomslayer Před rokem

    when will you mix rip and tear

  • @mmm2096
    @mmm2096 Před 9 měsíci

    lol does someone have you held hostage? good explanation but slow down man. Also why do all these tutorials have the classic microphone on the desk with you slapping the keyboard.