Delegates - Unreal C++ Course #15

  Рет қаралды 3,688

The Game Dev Cave

The Game Dev Cave

6 ай бұрын

Unreal has very good tools for visual scripting with blueprint but of course, there's always those who want to write their code. unreal offers scripting in c++. and while that might sounds like a nightmare, it's not as bad as you think. So come along and let's find out all about C++
Join the discord for any help you need! : / discord
support the channel and development over on patreon : / thegamingcaves

Пікірлер: 23
@facebotter
@facebotter 18 күн бұрын
This is the best explanation I've seen on delegates! Thanks!!
@ertugrulyilmaz4940
@ertugrulyilmaz4940 25 күн бұрын
Thanks man, i did not knew that the function parameter needs to be the same as declared for the delegate. That solved my issue!
@petarpehchevski3d338
@petarpehchevski3d338 2 ай бұрын
Really helpful video, thanks for making it!
@acecar3245
@acecar3245 3 ай бұрын
Fantastic video, very well explained. Thank you
@thegamedevcave
@thegamedevcave 3 ай бұрын
Glad it was helpful!
@LeRouxEnslin
@LeRouxEnslin Ай бұрын
Thank you for this. Well explained. Your effort has saved me hours.
@thegamedevcave
@thegamedevcave Ай бұрын
Glad to hear it!!
@RHRPaige
@RHRPaige 3 ай бұрын
thank u
@washynator
@washynator 6 ай бұрын
This was very useful! Thanks again!
@thegamedevcave
@thegamedevcave 6 ай бұрын
You're very welcome!
@PitiPedroHernandezCrespo
@PitiPedroHernandezCrespo Ай бұрын
Petty nice tutorial mate! I've got a question about delegates that maybe you can solve... If for any instance of BP_GrowingThing you have to select the instance of BPEnemy that they are tracking, isn't this like the oposite of event driven functions? I mean, whats the diference between this and: Add to the enemy class a reference to a GrowingThing and every time it shoots do GronwingThingWatched->Grow(); Am I missing something here? Thank you in advance tho!!!!
@thegamedevcave
@thegamedevcave Ай бұрын
Thw reason to use delegates instead of directly using functions is because of 3 reasons : 1. Every instance can have different actors listening to it so 1 enemy might have an actor listening thatll grow when it attack, another might have something listening thatll jump instead, and one thatll move, and one thatll become visible/invisible and so on. By using a delegate, different instances can have different kinds of listeners with totally different effects. 2. And more importantly, if you have 20 different classes listening to different instannces of your actor with the delegate (enemy class in this example), those listeners have to be aware of the contents of enemy class, but enemy class doesnt need ti be aware if the contents of whoever is listening, al it needs to know is that it calls out "hey, i did thing" and then amyone listining for that will do their response. That means the enemy class doesnt need to now #include every possible class that could listeb to it, which you would need to do if you made enwmy call functions directly on those listeners. 3. You can easily add listeners and remove them during gameplay. So lets say you have a button, when you press it, the "grow actor" adds itswlf as a listener to the closest enemy, thats really easy to do here without havibg to hard code a bunch of if statement so all together it makes for more flexibility and better scaling if you decide a new type of actor you made also should do something when Enemy calls out. Of course, on top of that youre also not limited to just the delegate on Enemy, if you want an actor to run a certain function when one if a few things happens, it can listen to multiple actors, different classes whatever you need it to do.
@WeirdGoat
@WeirdGoat 6 ай бұрын
Nice work! Have you covered interface yet? I feel like you could make one right after this video, since they are very alike.
@thegamedevcave
@thegamedevcave 6 ай бұрын
got a video about blueprint interfaces lined up for in a couple of weeks :)
@WeirdGoat
@WeirdGoat 6 ай бұрын
@@thegamedevcave Looking forward to it. I always learn something from different videos on a same topic, and then add the new info in my document, like a program vampire
@hawns3212
@hawns3212 3 ай бұрын
Hey! Not totally related to the video, but when I am trying to DECLARE_DYNAMIC_MULTICAST_DELEGATE it gives errors with intellisense. It still compiles just fine, but these intellisense errors are really annoying. How did you get your visual studio to ignore those or correctly detect that it is valid?
@thegamedevcave
@thegamedevcave 3 ай бұрын
i get error lines under my code more often, usually if those liens are not actually errors, they go away when compiling the code, if they ARE actual errors, it becomes apparent during compiling when it throws the error and tells you what's wrong. Hardly ideal but Personally i've gotten used to it by now.
@drakouzdrowiciel9237
@drakouzdrowiciel9237 Ай бұрын
👌
@TheKr0ckeR
@TheKr0ckeR 26 күн бұрын
Great tutorial, whats the difference between: DECLARE_MULTICAST_DELEGATE_OneParam DECLARE_DYNAMIC_DELEGATE_OneParam DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam One is without dynamic keyword, and one is without multicast keyword
@thegamedevcave
@thegamedevcave 26 күн бұрын
it's a bit bothersome for me to type out in a youtube comment but the unreal documentation has a few pages on it (which should really link to eachother, but they don't so i'll give you all the links) docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Delegates/ docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Delegates/Multicast/ docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Delegates/Dynamic/
@TheKr0ckeR
@TheKr0ckeR 26 күн бұрын
@@thegamedevcave Thanks a lot for the links! Didnt know there was much differences.
USTRUCT - Unreal C++ Course #16
16:17
The Game Dev Cave
Рет қаралды 567
Getting into C++ with Unreal Engine - Part4 - Enhanced Input
42:21
Follow @karina-kola please 🙏🥺
00:21
Andrey Grechka
Рет қаралды 21 МЛН
маленький брат прыгает в бассейн
00:15
GL Show Russian
Рет қаралды 4,3 МЛН
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 19 МЛН
Blueprint Interfaces | Unreal Engine 5 Tutorial
14:41
Tyler Serino
Рет қаралды 33 М.
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
UNREAL ENGINE | EVENT DISPATCHERS (BP) + DELEGATES (C++)
5:01
Creating a Selection Widget in Unreal C++
14:15
Scripted Adventure
Рет қаралды 1,4 М.
Nanite Displacement Tessellation in Unreal 5.4 is INSANE
10:14
The Game Dev Cave
Рет қаралды 1,2 М.
Unreal Engine Blueprint Fundamentals |  Class #1
59:45
Ask A Dev
Рет қаралды 23 М.
UE5 C++ 52 - How To Create Latent Action Blueprint Node With C++? - Unreal Tutorial CPP Delay Async
34:47
Alex Quevillon [En] (Unreal Engine Tutorials)
Рет қаралды 551
Introduction to Subsystems | Unreal Engine 5
9:01
Elliot DeMatteis
Рет қаралды 1,3 М.
Unreal Engine Interfaces: Everything you need to know #2 C++ Implementation
14:43
Sneaky Kitty Game Dev
Рет қаралды 4,9 М.
UE5 Common UI Guide: A Complete Guide to Inputs & Widgets
1:29:31
#miniphone
0:18
Miniphone
Рет қаралды 2,5 МЛН
Why spend $10.000 on a flashlight when these are $200🗿
0:12
NIGHTOPERATOR
Рет қаралды 18 МЛН
How about that uh?😎 #sneakers #airpods
0:13
Side Sphere
Рет қаралды 10 МЛН
Обманет ли МЕНЯ компьютерный мастер?
20:48
Харчевников
Рет қаралды 167 М.