Godot 4 Signals Explained

Поделиться
HTML-код
  • Опубликовано: 28 дек 2024

Комментарии •

  • @amoraampersand
    @amoraampersand Год назад +10

    such a good example / explanation of custom signals, i was struggling to understand how/when you'd pass arguments through a signal until now, thank you!

    • @brettmakesgames
      @brettmakesgames  Год назад +3

      You're so welcome, Astrid! Glad to hear to it was helpful.

  • @gavexefamin3032
    @gavexefamin3032 Год назад +6

    How do you do the connection if both are in different scenes? and Receive signals?
    Can you please help me out on that one?

    • @TriteanRares
      @TriteanRares Год назад

      I don't think you can use signals as events in for example .Net, however you could implement a signals hub that ties stuff together. Why you would use a signal if you already need a reference to the node, beats me

  • @LucasKelleher
    @LucasKelleher 8 месяцев назад

    OMG, thank you! I've been stuck for a while now completely misunderstanding how signals work, so this was just what I needed. You're the best, Brett.

  • @scarpheel
    @scarpheel Год назад +2

    Nice video, clear and easy to understand, no anoying music, good job

    • @brettmakesgames
      @brettmakesgames  Год назад +3

      Thanks! I appreciate the feedback. Yeah, I can't handle the consistent bg music and choppy editing of a lot of RUclips videos. 😂

  • @entei6736
    @entei6736 Год назад +5

    great video brett

  • @rebelheart4456
    @rebelheart4456 Год назад +1

    I wish I was as great as programming and using Godot as you are! Thanks for the amazing short tutorial!

  • @bclikesyou
    @bclikesyou Год назад

    Super helpful video for someone new to Godot. I followed along and then immediately tried to replicate your steps from memory; it helped a lot. Hope things are well, Brett!

  • @PeteGrammarman
    @PeteGrammarman Год назад

    Wow this is really helpful and explains it in such an easy to understand way. Thank you!

  • @adrian831226
    @adrian831226 Год назад

    Man, you're the best!
    you've really helped me in this journey. I love your videos, keep up the good work!
    Thanks a lot.

  • @DaveScurlock
    @DaveScurlock Год назад

    I did this today! Created my own signal for spawning a laser for an asteroid esq game (inspired by your own prototypes), and also used built-in signals to end the laser when it leaves the screen! 😁
    Your videos are quite advanced for someone brand new to Godot/coding, but it feels awesome to get to the point of watching back and understanding some of the points. Saw you created a patreon and have joined to support your journey to full-time indie dev

    • @brettmakesgames
      @brettmakesgames  Год назад

      Way to go! That's awesome. Thanks so much for your support on the Patreon, it means a lot. I plan on doing some more beginner friendly Godot and game programming videos in the future. I've been thinking about it a lot, and Godot has a lot of concepts that could be overwhelming for someone totally new to it. Going to think about ways to explain and focus on making it more approachable.

  • @erkling5865
    @erkling5865 Год назад

    pros and cons of using signals, and the alternative?

  • @dajoma36
    @dajoma36 9 месяцев назад

    Great video, very helpful!

  • @desent493
    @desent493 11 месяцев назад

    How would you connect the signal in code? The docs don't show how to do it with parameters.

  • @Betegfos
    @Betegfos Год назад

    Awesome explanation, I would like to connect a signal from an enemy to a global script that keeps track of stuff. Is it possible to connect the signal before the enemy was even spawned or shall I use static functions instead of singals? XD

  • @ernstpalfi6502
    @ernstpalfi6502 10 месяцев назад

    thanks, very helpful!

  • @RussPainter8
    @RussPainter8 Год назад

    Nice focused video. Thanks.

  • @sanyi9667
    @sanyi9667 Год назад +1

    you forgot to mention that you can also connect nodes in code - no need to use the connect way from signals tab in the godot UI

    • @randomnumbers84269
      @randomnumbers84269 Год назад

      How? Do you mean the "$" reference method? I'm just learning Godot and this connecting scenes and nodes via the editor like this feels like a bad idea. I want to do it inside the scrip.

  • @aneckdope
    @aneckdope Год назад

    brilliant video, thank you

  • @windowpanememberrrr
    @windowpanememberrrr Год назад

    unity refugee says thank you

  • @BetaTester704
    @BetaTester704 Год назад +2

    how about making connections purely through code?

    • @brettmakesgames
      @brettmakesgames  Год назад +2

      When you get a node in the code, you can just type out the signal you want to connect and call connect and pass in the callback. Here's the Godot docs on it: docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html#connecting-a-signal-via-code
      I haven't been covering much code-driven functionality yet in my screecasts, but I intend to. I myself am still figuring out my preferences there. Like when is it best to use the inspect and add scenes myself or when to do it dynamically.
      From the video, in code, you'd do: $Timer.timeout.connect(_on_timer_timeout) to wire it up with code.

    • @BetaTester704
      @BetaTester704 Год назад

      @@brettmakesgames I'm having trouble doing it with custom signals.

    • @brettmakesgames
      @brettmakesgames  Год назад +1

      I'll do some digging into that and share what I learn... haven't had to connect custom signals with code yet!

    • @BetaTester704
      @BetaTester704 Год назад +1

      @@brettmakesgames ty

    • @jefreestyles
      @jefreestyles Год назад

      Add a reference var for the node that has the signal. Then write [var or the $nodeName].[signal name].connect([signal function name]). Add optional parameter arguments to the signal function of appropriate.

  • @The-cyber-imbiber
    @The-cyber-imbiber Год назад +2

    coding using side effects (and by proxy, signals) seems extremely extremely extremely dangerous! For a small script it looks safe (and it is), but it outscales iself super quickly. Be careful using these! In software engineering in general (not just game development), whenever you think you need to do something with a side-effect, you usually don't! (with some exceptions)

    • @veto_5762
      @veto_5762 Год назад +1

      What side effect? Signals are the intended way nodes comunicate their state or data with one another
      Signals are just like an array of object references, when the signal is called it goes throught that array and tells every object that something happened by calling the deferred method; if theres nothing connected to the signal then no one is called.
      Is pretty common to do on gamedev when you want thing A to know when thing B did something the exact moment it happens.

  • @meraklmuskulpesent8313
    @meraklmuskulpesent8313 Год назад

    Thanks.

  • @thomasparker7305
    @thomasparker7305 Год назад

    I'm wondering is the at: res://main.... how did you get that to show? That would help me a lot.

    • @brettmakesgames
      @brettmakesgames  Год назад

      Would you mind explaining what you mean a little more or sharing a timestamp? Happy to help but unsure what you mean.

    • @BetaTester704
      @BetaTester704 Год назад

      Just the main scene.

    • @thomasparker7305
      @thomasparker7305 Год назад +1

      @@brettmakesgames I just looked at the video again, was working so first time I was able to check. And I figured it out. you uses print_debug() instead of just print(). This is going to help me out. Thank you.

  • @AshifKhan-sn6jx
    @AshifKhan-sn6jx Год назад

    I think I got the gist of it

  • @bonsaipropaganda
    @bonsaipropaganda Год назад

    you're the best