The Most Common Mistake Beginners Make in Unreal Engine | UE5

89,982
0
Published 2024-02-16
The Observer Pattern:
Software Design Patterns are like a manual on how to write good code, whether you're using Blueprints or C++, knowing good software practices is a MUST!

I hope this first video in the series gives you a good intro on what design patterns are and how the observer design pattern can be used.

This will be done through the use of "Event Dispatchers". Event dispatchers in unreal engine use delegates, which are an implementation of the pub/sub (observer) pattern.

Through blueprints, event dispatchers are available, but have certain limitations that will be touched upon in this series

Download the project files and support my channel on Patreon
www.patreon.com/Alizoh

Join my Discord server to chat and mingle with the community
discord.gg/AEnM4wvYzN

Additional Resources:
refactoring.guru/design-patterns/observer
gameprogrammingpatterns.com/observer.html
docs.unrealengine.com/5.2/en-US/delegates-and-lamb…

Chapters:
00:00 The Problem
00:24 Background Context
00:49 The Mistake
01:38 The Observer Pattern
02:49 The Publisher
04:05 The First Subscriber
07:11 The Second Subscriber
10:19 Summary
11:00 The Benefits
11:40 Coming Soon


About me:
I've been learning game development for a few years now, I have a background in software engineering, and I also have a background in education, so being able to combine my love of gaming, software engineering and education is the best way to spend my time.

I am currently working on a few unreal engine games as a hobby, but I am also trying to build a community, thus I am creating YouTube tutorials to find others who are interested in game development and design.


#unrealengine5 #observerPattern #tutorial #unrealengine #ue5 #gamedev #softwaredesign #software #designpatterns #cleancode

All Comments (21)
  • @peppastone
    This is the kind of tutorials youtube needs more of! You actually explain conecepts, instead of just telling your viewers to copy paste some code with no explanation. I don't leave comments often, but you definitely deserve it.
  • @perochialjoe
    It's almost uncanny how you described my exact method for this at the beginning. Thanks a lot for not just teaching solutions to problems, but teaching more efficient workflows and good practices while you're doing so. It might be more work up front but it absolutely pays off!
  • @swarnavadas5461
    You are an ABSOLUTE SAINT for actually explaining where concepts can be used for actual functionality in the engine instead of just showing people how to make a shiny looking functionality. God bless you man.
  • @EdenPresents
    I dont leave comments often, but just wanted to say that your tutorials are easy to follow, and I enjoy watching them! Youre doing a great job!
  • @Wrexthor
    Something you could add to avoid hard references to actors (like you have currently) is handling dispatchers in actor components. In that way you can have a reference to a generic character instead, get component by class, bind to onDeath that is ran in the component. Hard references should be avoided when possible because otherwise you will always have the entire enemy class and all its dependencies in memory whenever the Widget is in memory. Maybe its too much for one lesson, but i think it would be better to not teach hard references. I think these types of videos are badly needed and i hope you will make many more in the future. Excellent presentation and easy to follow.
  • @chantalduxfield
    This is the kind of UE tutorial video I've been searching for for years! It's so much easier to understand concepts and retain that kind of information when it's described and showcased in this way. Excellent work!
  • @jomesias
    In Unreal 5.2 and up, You can also just call interface functions on the overlapping or hitting actor. The enemy calls the player when hit and dead, the player calls the interface function for the door, when no more actors of class exist each time an enemy dead event is called. There are many ways of creating in Unreal with the new interface functionality. I’d say use interfaces to generate blueprints fast, and when working you can refactor to use proper patterns
  • @1point521
    THIS is EXACTLY what youtube tutorials should be like! Very helpful, easy to understand, you explain the why and hows. Perfect, thank you
  • @RikkuTheDead
    i learned some UE at school, more specifically blueprinting and i have been refreshing it a little and stumbled across your videos, i am flabbergasted, the way you explain things is so clear and simple! amazing work man! you're A-grade teacher material!
  • @realarchanger
    This is really kind of UE related content I've been looking for. Actually I'm pretty sure you did some kind of poll while ago or something and I was mentioning back then, that THIS kind of videos or tutorials or explanations is what I'm missing. I can't say I'm struggling, but there are times when I'm discussing my approach of designing some systems with experienced programmers. Thank you for this and I'm looking for more of this.
  • I've watched a few of your videos, and many others of others. And I have to say I am really looking forward to this series. The way you explain your code and the design patterns within it are some of the best ive seen on youtube.
  • @Daniel-sn5se
    My mind is blown how clean and easy someone is explaining that! You are a gem in all these Unreal tutorial channels. This is a real learning lesson and not just ''look at me how I did that and try to copy''. This is awesome.
  • @waw4428
    I'm intrigued, why would interfaces not be better for this? Wouldn't an interface send the same message to the blueprint and is actually easier to implement and to include other blueprints in the system? Especially if you have tens of thousands of actors.
  • @DarkoSubotin
    You could also update a variable in game mode class, the game mode could have its own event dispatcher and be called when an update occurs, and everyone listens to that ED in the game mode. This way you don't have to get all actors of class just the game mode. Game mode is accessible from anywhere so that would make it also easy to update the variables.
  • @Huunneerr
    Really appreciate your videos. I got so many of your vids in a playlist I use as a beginner to unreal engine 5. Just started learning this engine about 2 weeks ago, and it's so enjoyable learning something new and actually being able to understand it. Never stop posting PLEASE!! <3
  • @3dsakr
    A great tutorial!!, but there is a little adjustment that I would add to make it much better: instead of dispatching an event from the enemy, 1- I would create my own GameInstance class, and this can be referenced from anywhere. 2- Now in my GameInstance class, I would add the event dispatcher that you added in the enemy 3- in the enemy, call the GameInstance event that you added 4- in the widget, just reference the GameInstance, and bind to the event the benefit: you won't need to iterate all enemies to bind so many events (consider the worst case scenario of having thousands of enemies where you will have thousands of binds). Regards!!
  • @Butter007
    Hands down best tutorial I've watched so far in my early UE5 journey. You explain everything so well. The first video I didn't have to pause and rewatch 100 times.
  • @juggernautx1779
    Love these videos that resolve bad practices from other youtubers, amazing!
  • @troreen2154
    Wonderful video, no bs intro, straight to the point, no waste of time about a life story, love the work, keep it up.
  • Great video man. Im learning UE5 blueprints and the way you explain stuff is great, clear and smooth. Also great advice to avoid problems later on. Thank you and keep up the good work.