Functions, Macros & Events - #17 Unreal Engine 4 Blueprints Tutorial Series

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.ค. 2024
  • In this video we take a look at how we can create functions, macros & events and their uses within our code. We also go over some of the draw backs and differences them.
    Unreal Engine 4 Level Design Series: • Creating Video Game Le...
    ♥ Subscribe for new episodes weekly! bit.ly/1RWCVIN
    ♥ Don't forget you can help support the channel on Patreon! / virtushub
    ♥ Join the Virtus Dev Squad Discord: / discord
    Virtus Learning Hub // Media
    ● Facebook Page - / virtushub
    ●Twitter Page - / virtushub
    ● Website - www.virtushub.com/
    ------------------------------------------------------------
    My Recommended Desktop Setup:
    GTX 1060
    amzn.to/2CTTaoS
    AMD Ryzen 5 1500X
    amzn.to/2Cq8to1
    RAM Corsair 8 x2
    amzn.to/2CGSIO1
    Corsair CX750M
    amzn.to/2CsVQc3
    Case NZXT Phantom 410
    amzn.to/2CsVQc3
    Motherboard MSI Tomahawk
    amzn.to/2CsVQc3
    Corsair h110I Liquid Cooler
    amzn.to/2CsVQc3
    Blue Yeti Pro Microphone
    amzn.to/2CqPKsA
    Rode PSA1 Boom Arm
    amzn.to/2AvXuaU
    2TB HDD + 128GB SSD

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

  • @wink3319
    @wink3319 4 ปีที่แล้ว +49

    I like Virtus' videos a lot. However, here he forgot to pint something out: Functions and Events can be called from other Blueprints, Macros cannot. I find this difference important. Also, you can always add another event-graph and make it specific to the custom event if cleanliness is important.

    • @pranprotim3932
      @pranprotim3932 3 ปีที่แล้ว +1

      If you know so much, than why are you watching this tutorial lol 😂

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

      Thank you for the information. That’s quite useful to know ❤

  • @rgv3858
    @rgv3858 6 ปีที่แล้ว +8

    Thanks so much but... When to use each of them? I think you had to talk about delegated or observer pattern, according to the events use. Moreover, I think you can use delays and time managing in functions without context sensitive.

  • @EternalElir
    @EternalElir 6 ปีที่แล้ว +13

    Neat intro to the concepts, but this video had very little information on why you would use one over the other. Just going by the video, I see no reason to ever use functions in the off chance I might want to add a delay node. It also looked like you had more flexibility to use inputs and outputs with macros, but that functions did not offer that ability. While I haven't confirmed as much, I imagine the events are the best form of triggering a set of blueprint code from external sources or other blocks of graph work. You send the event from an external source, have the object receive the event, and then have the event trigger code, or even a function or macro. Using events inside the same graph seems like a good way to organize your graph to avoid having connections string over large distances.

  • @allashama
    @allashama 3 ปีที่แล้ว +4

    Let's clarify something for people who will read this message! Using a CustomEvent, you can hide your entire code in a '' Collapse Node '' if you select your entire code except the CustomEvent, and right click, you'll see '' Collapse Node ''. Click it and it will collapse your entire code in a simple node. Really clean if you use Collapse Node!

    • @Love_Peace_Giver
      @Love_Peace_Giver ปีที่แล้ว

      Thank you! this makes it much better now

  • @tcraigwilson
    @tcraigwilson 5 ปีที่แล้ว +9

    "Anyway, play around with these. Get used to them."

  • @ThimblewolfArt
    @ThimblewolfArt 4 ปีที่แล้ว +5

    I know I've said this before, but more practical examples would be really helpful.

  • @Compguy321
    @Compguy321 5 ปีที่แล้ว

    Good to know you can put a delay in a macro! Thanks!

  • @shadowwalker7213
    @shadowwalker7213 3 ปีที่แล้ว +1

    7:50 u can put the delay before the func one in the event btw , i still see no diff between them

  • @Fritz2824
    @Fritz2824 3 ปีที่แล้ว

    i want to do a function calculating A - B , and return the value.
    i think we cant do that with function, but with macro theres output node ?

  • @kjkh3104
    @kjkh3104 3 ปีที่แล้ว

    Do functions not allow only time related nodes that are given by default by ue4? What if I program in c++ my own time related function and use it there as a node, how can it possibly know it is time related?

  • @kenn5213
    @kenn5213 3 ปีที่แล้ว

    you cant add the delay in the function, but can you add the delay in the event before calling that function? (it seems like you could)

  • @jameshancox9723
    @jameshancox9723 2 ปีที่แล้ว

    Please could someone help , I would like to use a button in a UI on unreal 4.27 that has 3 functional uses, clicked , hold and release any advice would be amazing.

  • @jacobmowers4868
    @jacobmowers4868 6 ปีที่แล้ว +2

    Every time I get the Udemy ads I literally start dying inside.

  • @renderraj
    @renderraj 2 ปีที่แล้ว

    Thank you so much for the simple explanation.... I should have watched this a year ago..my life would have been easier :P

  • @shanjeevan142
    @shanjeevan142 4 ปีที่แล้ว

    Thank you

  • @Cherter
    @Cherter 6 ปีที่แล้ว

    Hey this comment doesnt really relate to this video but its ur most recent so i figured u would see it if i posted here. Ive been watching ur videos and they have helped me so much to create my very first game and i have made so much progress with ur help so thanks because i couldnt have done it without u. Now as i come to the final bits of finishing my first game i watched ur video on the day and night cycle and was able to get that working however the default sun that flies over the sky as the cycle goes doesnt fit the theme of my game and i was wondering if there was any way to change the look of the sun to something custom so i could have it better fit the art style of my game. Thanks

  • @andrelucas4473
    @andrelucas4473 3 ปีที่แล้ว

    So... there's no difference between them? Only the time thing?

  • @sean8306
    @sean8306 4 ปีที่แล้ว

    Good tutorial series, but practical examples would have been much appreciated and probably made it easier to understand.

  • @petercsordas6722
    @petercsordas6722 3 ปีที่แล้ว

    Why every loop prints for me 2 times?
    begin play
    for loop index:0
    index: 4
    print event
    and then it prints:
    event
    event
    event
    event
    event
    event
    event
    event
    whats the problem?

    • @blackcloak666
      @blackcloak666 3 ปีที่แล้ว

      Same issue here. Would be cool to know what causes this.

    • @DavidLavy
      @DavidLavy 3 ปีที่แล้ว

      I actually think I know why. You may have two TutorialCharacters in your workspace. If you play it you can see there's two of them. But when you stop it you can only see one. I don't know why you can't see the other one, but if you delete the one that's visible the loop should run just once.

  • @VirtusEdu
    @VirtusEdu  6 ปีที่แล้ว +4

    Functions, Macros & events, all explained here... enjoy!

    • @jieflowers
      @jieflowers 6 ปีที่แล้ว

      NO link?

    • @kiewass
      @kiewass 4 ปีที่แล้ว +1

      @@jieflowers Why? Its in the video.

  • @owencoopersfx
    @owencoopersfx 4 ปีที่แล้ว +1

    Like many of you I found this video slightly helpful, but mostly lacking in the information I was seeking, which is: why use a function vs. a macro? There isn’t any advantage to using a function over a macro that I can easily tell. I’m just guessing that best practice is to use macros only when a function can’t serve the same purpose (like when you need two execution inputs), but still don’t really know why.

    • @beaurawbone1066
      @beaurawbone1066 3 ปีที่แล้ว

      Hey I'm completely new to UE 4... as in I've been learning it for less than a week now so do you think you could explain what Functions and Macros even do? I didn't really get that from the video :( If it's too complicated to explain just an example of when you use them would be fine too. Thx if you reply.

    • @willlham1
      @willlham1 3 ปีที่แล้ว

      @@beaurawbone1066 from my experience you would create a function for code that you would repeat a lot or would like to use in another blueprint. For example you could create a take damage function on your player. Let's say you have survival mechanics and when you reach 100 hunger, you start to take damage. You could also have enemies that can shoot at you and damage you, for this you could cast to your player and use the take damage function in the enemy BP to let them damage your player.
      Macros are usually used I believe to tidy up code (although functions can do the same) and can only be used inside of the class you're in. I'm pretty sure I've read that you can run multiple execution pins as well so could have the option to change your code dynamically depending on what pin you use.
      Events are similar to functions in how they can be calling publicly in other classes but you can also use event dispatchers with events which I don't fully understand myself but they basically listen out for the event and can run code when that event fires. So for example when you pick up an item you could have an event dispatcher that tells another class you've picked up the item (Like for a quest)

  • @dszvivian
    @dszvivian 3 ปีที่แล้ว

    c++ vs blueprint??
    is c++ even worth it ??

  • @cipriancristian9933
    @cipriancristian9933 3 ปีที่แล้ว

    at the end police comes for him for explaining too good

  • @OverloadPlays
    @OverloadPlays ปีที่แล้ว

    2022🎉

  • @allashama
    @allashama 3 ปีที่แล้ว

    I personnaly doesnt see any interest to use a macro or a function when i can use a customEvent and write my code and '' Collapse Node '' it when it's done! it's only a preferred choice. 3 options are great but CustomEvent can do all of them.

  • @Gothdir
    @Gothdir 4 ปีที่แล้ว

    I like the effort but I feel a lot of those videos dont have enough basic information and this video is very basic. Im at video 14 now and I still wonder if all the variables can be called globablly. I feel like the video should 5 minutes longer to explain things ina little more detail.

    • @zinetx
      @zinetx 3 ปีที่แล้ว

      You should watch Blueprint Communications | Live Training | Unreal Engine
      from the official UE4 channel.
      th-cam.com/video/EM_HYqQdToE/w-d-xo.html

  • @ramiru3264
    @ramiru3264 ปีที่แล้ว

    Okay, I have been watching since the first video in the series but this one has gone south. As others say, you should use a more specific example for every functionality.

  • @DRAWKCABLLA
    @DRAWKCABLLA 2 ปีที่แล้ว

    you fail to mention setting up the custom events. jeez

  • @Pac-bq2sn
    @Pac-bq2sn 4 ปีที่แล้ว

    So sick of this intro and outro