Unreal vs. Unity: Actors & Components, Inheritance & Composition

  Рет қаралды 36,378

Alex Forsythe

Alex Forsythe

Күн бұрын

Unreal, Unity, and Godot have some similar design patterns, but there are a few things that set UE4 apart. We'll look at the range of Actor and ActorComponent classes available in Unreal, and we'll explore a few different ways to put them together.
Sample project: github.com/awforsythe/Touchy/
00:00 - Introduction
00:48 - Basic game object construction in Unity, Godot, Unreal
02:51 - Common concepts: Game World, Game Object, Component
03:33 - Components in Unreal: UActorComponent, USceneComponent, UPrimitiveComponent
05:36 - Game objects in Unreal: AActor
06:20 - Actor history: monolithic actors in UE2, component refactor in UE3
06:53 - Actor inheritance and subtyping, in addition to ActorComponent inheritance
07:40 - When to use Actor vs ActorComponent
08:18 - Example: First-person interaction via base class, interface, or component
10:27 - The case for plain old Objects
12:07 - Conclusion
Patreon: / alexforsythe
Twitter: / alexforsythe
#UnrealEngine #UE4 #programming

Пікірлер: 100
@anthonyapm
@anthonyapm 10 ай бұрын
Where did you go man? Best tutorials on the tuubs.
@mana20
@mana20 3 жыл бұрын
How do you only have 3k subs? This is better quality than most paid courses
@GasterLab
@GasterLab 8 ай бұрын
Because he's not updating content on this channel for two years xD
@mana20
@mana20 8 ай бұрын
@@GasterLab He's probably got better things to do than make KZfaq videos for free.
@klausklavikus3836
@klausklavikus3836 8 ай бұрын
Well the thing is there is rly not much more to tell about the Engine 🤷‍♀ @@GasterLab You got realy everything worth to know about Unreal 😂
@alphamineron
@alphamineron Ай бұрын
All*
@greyly_
@greyly_ 3 жыл бұрын
I've been coding for 38 years and last week I decided it was time to learn a game engine. Unity's C# API was immediately obvious to me and felt clean. My initial impression of UE4 was that it's a mess, struggling under the weight of layers of legacy. I'm happy to have found someone making videos about these things that seems to be an actual experienced developer and who can set me straight.
@Ruhrpottpatriot
@Ruhrpottpatriot 3 жыл бұрын
It's really not that bad. Most people I've seen struggling with UE4 are trying to work against the engine by trying to apply concepts that hardly work in UE (but can be done in an UE way). For example, the two inheritance trees: C# has the same notion with everything starting at "Object" (that's where UE got it from, actually). In UE it just sticks out because AActors and AActorComponents are the most often used classes. Does UE have legacy things that are a PITA? Yes, the immediate thing that comes to mind is AHUD, but even those can be useful in certain situations. For example in my project most of the UI is written in Slate and using AHUD makes it much easier. But if you have a simple UI that just has UMG you can make a master widget and do everything there.
@SirToxe
@SirToxe 2 жыл бұрын
@@jfht318 UE is clearly not what you are looking for in the first place so blaming it seems a bit daft. Maybe you should look into something like SDL2?
@ViceAdmiralHoratioNeIson
@ViceAdmiralHoratioNeIson Жыл бұрын
Unfortunately Unity seems hell-bent on doing the same thing with the number of systems they're deprecating and replacing at a snail's pace
@Sergeeeek
@Sergeeeek 5 ай бұрын
Yeah, at least in unreal if they introduce a feature that's experimental it usually becomes stable in the next few releases (and they're probably using it in fortnite already, so it's stable enough). When they deprecate something like the old input system, they have a way to gradually migrate.
@TheLolilol321
@TheLolilol321 2 жыл бұрын
This video is incredible. Every single frame is spring-loaded with accessible, useful information. It takes
@uzizizu
@uzizizu 2 жыл бұрын
you should apply for Unreal Grant, they give money for people who teaches their engine and you are a GOD in teaching
@shableep
@shableep 2 жыл бұрын
Seriously!
@AlexForsythe
@AlexForsythe 3 жыл бұрын
Quick correction: in the DefaultGame.ini snippet shown at 11:52, the object path should read: [/Script/TouchyCore.InteractionTrace] Also note that the reason for UInteractionTrace being a class is that it encapsulates both data and functionality - if we just wanted to run a simple line trace and we didn't care about debug drawing or having a configurable distance, then it'd make sense to just call UWorld::LineTraceSingleByChannel directly in our Pawn's tick function. In cases where you have a complicated bit of functionality (but no accompanying state) that you want to factor into a reusable form, then a plain old function is often the way to go.
@shreyas7801
@shreyas7801 3 жыл бұрын
I can't believe that you only have 5k subs!! Your production quality is better than most of the tutorials on youtube.
@Zamaroht
@Zamaroht Жыл бұрын
As a developer with 7 years of experience in Unity who has never used Unreal before, this was really insightful, thank you. I found myself pausing the video every few seconds to digest the examples and concise information, or to play around a bit in the editor. Everything was really well explained and clear, thank you! It's definitely a bit of a paradigm shift
@anilhdas
@anilhdas 2 ай бұрын
Couldn't agree more here!
@rahdanger4277
@rahdanger4277 3 жыл бұрын
You are the fuckin best teacher I have ever seen I still need and don’t fully understand everything yet , but this video has just given me the biggest learning leap yet , thank you sir I absolutely mean that thank you thank you and don’t ever stop
@kiaranr
@kiaranr 3 жыл бұрын
Brilliant, clear explanations of a complex topic. Coming from Unity to Unreal, it took me a very long time to piece together a mental mapping of how their architectures relate. Looking forward to your next video! This may be the channel that finally convinces me to use Patreon.
@beanboy504
@beanboy504 3 жыл бұрын
Absolutely without a doubt the best videos on Unreal Engine, please keep creating. I know how much work the fancy animations can be, especially is bulky software like After Effects, but they are SO worth it! That hierarchy graph cleared up so much confusion for me about the Actor hierarchy in unreal. This explains how even though Unreal uses a composition approach it always seemed so different than Unity or Godot!
@beanboy504
@beanboy504 3 жыл бұрын
Also SUBBED
@FarazKhan-lg9ul
@FarazKhan-lg9ul 3 жыл бұрын
Amazing video! the visualization is easily getting the point across. It’s surprising that unreal tutorials are missing basic vids like engine breakdown. Alex this makes your video really valuable especially for beginners. Keep up the good work!
@mariosbikosvideos
@mariosbikosvideos 4 ай бұрын
Damn I really want Alex to come back and do more videos like this one. The video visualisations are amazing!
@teac117
@teac117 9 ай бұрын
This is a very helpful 30,000 ft view of the architecture hierarchy. And props for front-running typical programmer questions of 'can we just use...'
@owencoopersfx
@owencoopersfx Жыл бұрын
This is seriously an excellent video. I work both with Unity and Unreal, and this is a great explanation of the differences between them.
@owencoopersfx
@owencoopersfx Жыл бұрын
I typically have the mindset that: - Unity leans more heavily into composition, where your prefabs define what the objects actually ARE, but the scripts don’t define what the thing is. - Unreal leans more heavily into inheritance and is truer OOP, where your objects aren’t necessarily just a composition of things, but actually ARE the thing.
@clearsky4049
@clearsky4049 Жыл бұрын
Best video I've seen on the topic by far. No bloat, clearly made by someone with experience, presented with good real world examples. Can't ask for better honestly.
@TonOfHam
@TonOfHam 3 жыл бұрын
First Class! I'm going to make this and your other recent videos mandatory viewing for all our developers.
@estranhokonsta
@estranhokonsta Жыл бұрын
Thanks. That was extremely useful. I will need to re-check this video often when i am stuck in the old "high on OOP approach" as i surely will. Changing ingrained habits is not so easy...
@nikhilraktale6750
@nikhilraktale6750 6 ай бұрын
Freaking finally ... Thanks for explaining the dual hierarchies !
@nickcy5083
@nickcy5083 2 жыл бұрын
This is amazing, the best video I've seen that goes into the different popular engines' approaches and their differences. Thank you so much!
@spalunkiA
@spalunkiA 8 ай бұрын
Really appreciate sucha comprehensive and effective video. Really helps me understand the conceptual structure of UE more than any tutorial I've tried before. Thank you
@TwiejkVR
@TwiejkVR Жыл бұрын
dude..... for free? you are a legend
@QuackTeamJames
@QuackTeamJames 3 жыл бұрын
Very interesting video :D Now I want to play around in Unreal when I get the chance to see what I can come up with using the blueprints and actors. Looking forward to the next one! Thanks for all your hard work Alex.
@IgnoreSolutions
@IgnoreSolutions 2 жыл бұрын
Thank you so much for this. Unity was easy for me to grasp as a desktop C# developer, but Unreal's macro playground & inheritance tree had me confused. While still slightly confused, I feel as though I have a much more solid grasp of these concepts now. So thank you!
@napstablook25
@napstablook25 2 жыл бұрын
I have been watching your whole unreal playlist. This is the video I have just started but I just have to say. This series is brilliant and heaven-sent. I have already learnt so much from these videos and I plan to learn everything you have to offer. I am not a Patreon guy but each video is making me think, "Just support the guy. This is the kind of content that you need to learn" and I am on my way to becoming a Patreon. At least in the lower tier for now. Thank you for this brilliant content.
@G0WithTheFl0w
@G0WithTheFl0w 3 жыл бұрын
Amazing video Alex! Very well done. Thank you for making it.
@christhwaites
@christhwaites 11 ай бұрын
Thank you for putting this together Alex! It's probably the most concise and informative overviews of Unreal's core types I've seen, dare I say easier to grasp than the official docs! I was wondering how you're creating the branching nodes animation? Thanks again and hope you keep making videos like this!
@ArtVandelayInc
@ArtVandelayInc 3 жыл бұрын
Flawless... You're so good at this
@user-jp3em3rk6j
@user-jp3em3rk6j Жыл бұрын
A really really useful tips , this is so friendly to watch!
@conkerconk3
@conkerconk3 9 ай бұрын
You make some of the most educational videos ever! I used unity for a long while because of how simple the scripting is and I didn't even realise UE had the components similar to unity; i thought it was just either custom actor or interface. Composition for the win
@unreolog8699
@unreolog8699 3 жыл бұрын
I think this channel one of the most important channels about Unreal Engine for those who want to understand the engine more deeply. Alex, thank you! I believe that you will continue to do education content because you are EPIC and deserve Epic Mega Grant too.
@krisitak
@krisitak 3 жыл бұрын
Alex, amazing channel! Thank you very much.
@infinitiom
@infinitiom 2 жыл бұрын
Increíble la calidad de tus Videos ! Muchas Gracias por compartir !
@jessexing3456
@jessexing3456 Жыл бұрын
What a fantastic video!
@yunus5949
@yunus5949 2 жыл бұрын
Really cool tutorials! Congrats !!!
@AmeenAltajer
@AmeenAltajer 2 жыл бұрын
Superb work man, keep 'em coming.
@iercan1234
@iercan1234 2 жыл бұрын
im glad i found this channel, this is really cool!
@Dayogg
@Dayogg 2 жыл бұрын
Thank you, important topic.
@irtezarahman5370
@irtezarahman5370 2 жыл бұрын
You deserve millions subscribers. subscribed
@backgroundmusicorg6960
@backgroundmusicorg6960 3 жыл бұрын
Great Video !! helped a lot with my switch to unreal
@Th3EpitapH
@Th3EpitapH 2 жыл бұрын
you're running a real good channel here man. keep it up
@volodymyrbarannik179
@volodymyrbarannik179 3 жыл бұрын
More videos about game design patterns, please!
@svenyo
@svenyo 3 жыл бұрын
This is pure gold!
@mikul3122
@mikul3122 Жыл бұрын
ty so much for these
@StrayVertex
@StrayVertex 3 жыл бұрын
Super informative video, thx!
@l_t_m_f
@l_t_m_f 10 ай бұрын
Thank you best videos ever!
@VonchkynProduction
@VonchkynProduction 2 ай бұрын
Thank you for the informative video:)
@trampflips101
@trampflips101 3 жыл бұрын
8:30 I feel like most people are still high on OOP :/ I got a laugh out of that though
@krisitak
@krisitak 3 жыл бұрын
Hey Alex, I really enjoy your videos. At @10:48 you make the case for the UObjects. Recently I have discovered the UDataAsset. I'd like to hear your opinion on the "UObject vs UDataAsset" discussion.
@user-gy6cv3ug5i
@user-gy6cv3ug5i 3 жыл бұрын
Really great video, extremely well explained and illustrated. Rather than instantiating a new UObject helper class as you did for UInteractionTrace in this video, would creating a UObject class with static methods be equally viable? Unreal makes heavy use of these kinds of classes in C++ for many common operations like spawning FX (see UGameplayStatics for examples). I find this easier as you just need to include the header of that class in whatever cpp you are using it in and call UMyStaticsClass::LineTrace and pass the TraceDistance / bDebugDraw as arguments to the function!
@AlexForsythe
@AlexForsythe 3 жыл бұрын
Yep, that's a totally valid approach: if you're just defining a set of functions, you can extend UBlueprintFunctionLibrary and declare static BlueprintCallable functions (using a WorldContext parameter as needed; see GameplayStatics.h for examples), and then those functions will be callable from Blueprints and C++. A bit more on the thought process here - I wanted the input parameters for the trace (TraceDistance and bDebugDraw) to be UPROPERTYs, so that I could: - Hardcode default values for those parameters in whatever class owned them, while also allowing those values to be viewed or overridden in Blueprints - Flag them as Config so those defaults could be overridden in a config file - Use console commands to get/set their values at runtime in standalone development builds (e.g. I could run 'GetAll InteractionTrace bDebugDraw' to check whether debug drawing was enabled and use 'Set InteractionTrace bDebugDraw True' to enable it) Those properties have to be declared somewhere, so that leads me to two equally sensible approaches: either put the data in the Pawn class (in which case the Pawn either handles the trace directly or calls a static helper function and passes in those parameters), or wrap up the data alongside the trace functionality in a helper class (in which case, the Pawn just tells its helper object "OK please run a trace now", and other code that references the Pawn doesn't have to know anything about how the trace works). Either approach is fine - I mostly wanted to demonstrate how you can use simple helper classes to encapsulate different bits of functionality, and how UObject is a valid choice for those helper classes. A common principle in software design is that each class (or module, or function) should have exactly one responsibility, and it's a common pitfall in Unreal projects for the PlayerController and Pawn classes to grow grotesquely huge and messy, since it's so tempting to just add new functionality directly to those classes without any indirection. That can work perfectly fine in simple cases, but as projects grow in complexity it can become more and more of a nightmare to maintain. The key takeaway is that you can avoid that problem by keeping your Pawn (or Controller, or GameMode) simple and having it defer to separate interfaces to handle different overarching responsibilities, whether those interfaces are defined as a set of plain ol' C++ functions, a set of static functions in a UBlueprintFunctionLibrary subclass, a raw C++ struct or class, a UObject class, an ActorComponent, or a full-blown Actor.
@user-gy6cv3ug5i
@user-gy6cv3ug5i 3 жыл бұрын
@@AlexForsythe Thank you for the incredibly detailed answer, very interesting to hear your reasoning there, definitely makes sense that you’d go with the instantiated UObject if you wanted the extra control that it brings as mentioned. Keep up the great work, thoroughly enjoyed this video
@mana20
@mana20 3 жыл бұрын
@@AlexForsythe how about the use of Subsystems? What use cases would that be more beneficial than a UObject? Coming from Unity I'm also trying to understand how to handle "Manager" classes and Subsystems seemed like a good fit to handle encapsulation. However debugging seems harder to do within the editor.
@Ovicior
@Ovicior 3 жыл бұрын
Subbed. Good content.
@ajharbeck2075
@ajharbeck2075 Жыл бұрын
Would've been nice if he went into more detail on Godot and it's stucture.
@pontosinterligados
@pontosinterligados Жыл бұрын
These videos are amazing. 4 years ago I was developing a spatial experiment in games and tangible level creation for my PhD and as a prototype I had build myself a game engine in processing to deal with the electronics and special rendering demands. It worked, but I wanted to move forward and learn if I could use these amazing engines to distribute my research. I left academia/started working and didn’t find a way (time) to study how to implement my project on unreal or unity so far. I was wondering if I could have some sort of tutoring to get me back on tracks with this sort of development
@mana20
@mana20 2 жыл бұрын
I'd recommend data management (tables, data assets, external formats like JSON and how and when to use them.) As a future video if it interests you.
@slimnet04
@slimnet04 2 жыл бұрын
vids so good
@kken8766
@kken8766 3 жыл бұрын
i am your big fan now !!
@cocacola7535
@cocacola7535 2 жыл бұрын
Sir, how did you make your slides consisting of animated code and diagrams? Using LaTeX `beamer` document class?
@nfrancisj2122
@nfrancisj2122 3 жыл бұрын
Great!
@thecancermen245
@thecancermen245 3 жыл бұрын
good stuff
@GraaD-87
@GraaD-87 3 жыл бұрын
It started as "2+2=4" and then in a blink escalated to rocket science so I totally lost any hope of understanding anything. Shows how little I know, really. Great video though. =)
@mkaram4893
@mkaram4893 2 жыл бұрын
This is really unbelievable! I used Unity for 10 years.. and I keep regretting my life choices and decide to switch to Unreal every few months.. but I get overwhelmed by its complexity and stay in the Unity world (my comfort zone)... after watching a few of your videos, I was able to get something working in Unreal for the first time! you made everything clear and simple from the point of view of a Unity developer.. Thanks a lot man!!! This is better than any paid course I've ever seen.. if you ever decide to make a paid course I'll be the first to buy it.
@shableep
@shableep 2 жыл бұрын
Did you end up sticking it out with Unreal?
@mkaram4893
@mkaram4893 2 жыл бұрын
@@shableep nope xD back to Unity :)
@shableep
@shableep 2 жыл бұрын
@@mkaram4893 Interesting. What made you switch back?
@mkaram4893
@mkaram4893 2 жыл бұрын
@@shableep so restrictive, e.g. can't have something like Unity Events out of the box that lets you configure different behaviors for each instance of a script in the UI is a big NO for me..
@rahultandon9749
@rahultandon9749 Жыл бұрын
This video remains unmatched and with no parallel. Also, please comment on the ECS pattern /architecture. UNREAL does have ECS. However, like UNITY, is making a step-wise roll-out of the capability. What's happening with the two? A code-base rewrite .....?
@jimmytrouble7038
@jimmytrouble7038 4 ай бұрын
such a good video dude, how ever are you aware as to why they called them "Actors", its a confusing term to me, i was wondering why they went with the name, I cant find anything online about
@aaronbrady5237
@aaronbrady5237 9 ай бұрын
"It's the 90's and we're all high on OOP" lmaoooooo
@kunyan164
@kunyan164 2 жыл бұрын
so cool , i want to know how to make these cool anmations like code animation
@ymi_yugy3133
@ymi_yugy3133 3 жыл бұрын
I hope this get's simplified a bit with UE5.
@yunus5949
@yunus5949 2 жыл бұрын
You should keep going to publish new content!
@3sgamestudio
@3sgamestudio 3 жыл бұрын
omg I wish that my videos were 1/5 of the professional level of your videos : (
@beanboy504
@beanboy504 3 жыл бұрын
Crazy to see you here! Keep up the good vids :)
@guyalsfere7470
@guyalsfere7470 2 жыл бұрын
"Its the late 90s and we're all high on OOP"
@nicolasgalipeau3632
@nicolasgalipeau3632 2 жыл бұрын
1337, nice
@manasjoshi2939
@manasjoshi2939 9 ай бұрын
I wish you didn't stop uploading😔
@zeddgamedesigner
@zeddgamedesigner 2 жыл бұрын
Unity or Unreal engine?? your opinion.....
@khealer
@khealer 8 ай бұрын
13:37 LOL
@trampflips101
@trampflips101 3 жыл бұрын
leet video length, even leeter video quality ;)
@SnakeEngine
@SnakeEngine 2 жыл бұрын
In Unity you can have child objects. In Unreal only child components. Isn't it limiting?
@Western_TV
@Western_TV 11 ай бұрын
1337
@neotrixsine7846
@neotrixsine7846 Жыл бұрын
As a Unity user, I understood nothing from Unreal Engine explanation
@OnyeNacho
@OnyeNacho 2 жыл бұрын
You should have named this "Unreal vs Unity vs Godot: Actors & Components, Inheritance & Composition". Slightly misleading when the comparisons are actually three engines, not two of them.
@youngtran8986
@youngtran8986 2 жыл бұрын
Only thing Epic Game need to put in their "Unity User" document section is this video. The rest is useless.
@Manu-wq1io
@Manu-wq1io 2 жыл бұрын
Someday you can explain the ambiguity that exists between world, level, map, in Unreal, and how seamless travel works to create large open worlds with persistent actors.
The Unreal Engine Game Framework: From int main() to BeginPlay
27:22
Alex Forsythe
Рет қаралды 194 М.
Unreal Actors vs GameObjects
11:30
Craig Perko
Рет қаралды 5 М.
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 80 МЛН
UFC 302 : Махачев VS Порье
02:54
Setanta Sports UFC
Рет қаралды 1,3 МЛН
Backstage 🤫 tutorial #elsarca #tiktok
00:13
Elsa Arca
Рет қаралды 14 МЛН
1 класс vs 11 класс (неаккуратность)
01:00
Multiplayer in Unreal Engine: How to Understand Network Replication
22:08
The Roots of Unreal Engine 4: Game Engines from 2006 to Today
9:47
Alex Forsythe
Рет қаралды 20 М.
Why Favor Object Composition Over Class Inheritance? A Deep Dive
19:00
What is Composition over Inheritance? #programming
8:27
Metaphorically Speaking
Рет қаралды 4,7 М.
Blueprints vs. C++: How They Fit Together and Why You Should Use Both
47:14
SIMPLE Tip For Better Unity Game Architecture
12:57
git-amend
Рет қаралды 25 М.
Why I'm not switching to Unreal Engine... | Unity vs Unreal
7:08
Kyle Banks // Farewell North
Рет қаралды 156 М.
Software Architecture in Unity
7:13
Jason Storey
Рет қаралды 111 М.
Unreal Engine C++ Project Setup, From Scratch
30:46
Alex Forsythe
Рет қаралды 78 М.
How do non-euclidean games work? | Bitwise
14:19
DigiDigger
Рет қаралды 2,4 МЛН
1🥺🎉 #thankyou
00:29
はじめしゃちょー(hajime)
Рет қаралды 80 МЛН