What in the world is call_deferred?

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 พ.ย. 2024

ความคิดเห็น • 27

  • @cashewolddew
    @cashewolddew  3 หลายเดือนก่อน +1

    To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/CashewOldDew/ . You’ll also get 20% off an annual premium subscription

  • @RenderingUser
    @RenderingUser 3 หลายเดือนก่อน +11

    Man's answering Questions ive kept in the back of my mind without even realising

  • @NightKoloAlt
    @NightKoloAlt 3 หลายเดือนก่อน +1

    I came here from twitter, thank you for bringing up the question and striding to answer it. I've personally learned a lot of valuable syntax, very neat video.

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน

      Thank you so much! It is great to see people joining in from other platforms. I'm very happy it helped you! 🥜

  • @mohsenzare2511
    @mohsenzare2511 2 หลายเดือนก่อน

    Very good video! I hope to see more!

  • @Komil484
    @Komil484 3 หลายเดือนก่อน +2

    5:38
    for the `rotate` function in `_process`, instead of decreasing the `rotation_amount`, it's better to multiply it by `delta`

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +2

      Since Delta is a really small number, it does, indeed, make the rotation amount smaller.
      However, since there was no need for framerate independent movement in this case, I didn't want to complicate the example 🥜

  • @thanatos454
    @thanatos454 11 วันที่ผ่านมา

    You can also avoid those warnings by connecting in a different lifetime function that doesn't run more than once, like _init()

  • @Komil484
    @Komil484 3 หลายเดือนก่อน

    10:35
    I believe there's a small error, because the peanut actually gets printed right _before_ `process` is processed. Another thing to note is that, connecting each frame with CONNECT_ONE_SHOT, whilst emitting the signal each frame as well is inadvisable. It is better to simply connect once, perhaps in `_ready`, but this does change the behaviour slightly, as it prints before the very first frame as well, whereas in yours it skips the 1st frame, and starts printing before the second one

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน

      Regarding the process_frame signal, that is a very good observation.
      The docs really say that the signal is emitted right before the next process frame. So, in the example, the first frame was executed, and, right before the next frame, a peanut was printed.
      It is true that if I would've had called the signal binding in the ready function, a signal would've been emitted right before the first frame, printing the peanut first.

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +1

      And yes, connecting a signal each frame would not make too much sense in a real scenario.
      For demonstrative purposes, I just wanted to do that each frame to showcase that there was no desynchronization between the prints, as in, the peanut always grts printed right before the next frame.
      Thanks a lot for the comment! It really shows that you have a good understanding of how this works! 🥜

  • @Aserenesnow
    @Aserenesnow 3 หลายเดือนก่อน

    What a timing yt recommend this video, yesterday I was struggling with this error then after so many tries I got it working and today TH-cam is recommending me this video 😮😂

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน

      Next time I'll upload 1 day earlier! Ha ha 🥜

  • @underreboot6418
    @underreboot6418 2 หลายเดือนก่อน

    Hey, Love your tutorials, any chance you could cover how to set up multiplayer in Godot?

    • @cashewolddew
      @cashewolddew  2 หลายเดือนก่อน

      Thanks for the great idea! I'l add it to the list! 🥜

  • @kristiantodt6490
    @kristiantodt6490 3 หลายเดือนก่อน +2

    Actually I was getting errors in godot telling me to use this when I set colliders to disabled but when I used call_deferred (or rather set_deferred) the behavior was wonky and when I just did collider.disabled = whatever then it worked well. Would you say it is alright to just ignore the errors?

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +2

      It could be that wonky behavior came from other functionality in your code. I would personally take those errors into account! An added benefit to fixing them would be easier debugging and logging as your console would be less cluttered without them. 🥜

  • @oppaibot
    @oppaibot 3 หลายเดือนก่อน +1

    I use call_deffered when procuderally spawn ui elements. like active selected tabs do not shown as selected if you didin't use deffered call to activate it and such other UI cases.

  • @Muphet
    @Muphet 3 หลายเดือนก่อน +1

    so if call_deferred is always preferred, it should just be default ._. what are actual use cases of not using call_deferred?

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +9

      There are a lot of cases in which you would want to call functions, get values, etc. in the current frame.
      Call_deferred is an alternative for special cases in which doing something immediately could break the game.

  • @HarrisonLaytone
    @HarrisonLaytone 3 หลายเดือนก่อน

    Gonzalez James White Thomas Garcia Timothy

  • @i_dont_know_my_name
    @i_dont_know_my_name 3 หลายเดือนก่อน

    god

    • @cashewolddew
      @cashewolddew  3 หลายเดือนก่อน +2

      That's precisely how you write 'dog' backwards! 🐶

  • @ArsoodDev
    @ArsoodDev 3 หลายเดือนก่อน

    You are my ddsh