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

Поділитися
Вставка
  • Опубліковано 25 тра 2024
  • 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 місяців тому +8

    Where did you go man? Best tutorials on the tuubs.

  • @mana20
    @mana20 3 роки тому +175

    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 місяців тому +2

      @@GasterLab He's probably got better things to do than make UA-cam 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 16 днів тому

      All*

  • @greyly_
    @greyly_ 3 роки тому +109

    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 роки тому +14

      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 роки тому +6

      @@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 Рік тому +9

      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 місяців тому +1

      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.

  • @uzizizu
    @uzizizu 2 роки тому +7

    you should apply for Unreal Grant, they give money for people who teaches their engine and you are a GOD in teaching

  • @AlexForsythe
    @AlexForsythe  3 роки тому +33

    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.

  • @TheLolilol321
    @TheLolilol321 2 роки тому +20

    This video is incredible. Every single frame is spring-loaded with accessible, useful information. It takes

  • @Zamaroht
    @Zamaroht Рік тому +9

    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!

  • @shreyas7801
    @shreyas7801 3 роки тому +16

    I can't believe that you only have 5k subs!! Your production quality is better than most of the tutorials on youtube.

  • @rahdanger4277
    @rahdanger4277 3 роки тому +9

    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 роки тому +20

    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.

  • @mariosbikosvideos
    @mariosbikosvideos 3 місяці тому

    Damn I really want Alex to come back and do more videos like this one. The video visualisations are amazing!

  • @teac117
    @teac117 8 місяців тому +1

    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...'

  • @beanboy504
    @beanboy504 3 роки тому +10

    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!

  • @FarazKhan-lg9ul
    @FarazKhan-lg9ul 3 роки тому +12

    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!

  • @owencoopersfx
    @owencoopersfx Рік тому +1

    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 роки тому +2

    First Class!
    I'm going to make this and your other recent videos mandatory viewing for all our developers.

  • @IgnoreSolutions
    @IgnoreSolutions 2 роки тому +1

    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!

  • @nikhilraktale6750
    @nikhilraktale6750 5 місяців тому

    Freaking finally ... Thanks for explaining the dual hierarchies !

  • @nickcy5083
    @nickcy5083 2 роки тому +1

    This is amazing, the best video I've seen that goes into the different popular engines' approaches and their differences. Thank you so much!

  • @QuackTeamJames
    @QuackTeamJames 3 роки тому +1

    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.

  • @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...

  • @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

  • @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.

  • @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

  • @ArtVandelayInc
    @ArtVandelayInc 3 роки тому +2

    Flawless... You're so good at this

  • @christhwaites
    @christhwaites 10 місяців тому

    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!

  • @AmeenAltajer
    @AmeenAltajer 2 роки тому

    Superb work man, keep 'em coming.

  • @jessexing3456
    @jessexing3456 Рік тому +1

    What a fantastic video!

  • @krisitak
    @krisitak 3 роки тому +2

    Alex, amazing channel! Thank you very much.

  • @yunus5949
    @yunus5949 2 роки тому

    Really cool tutorials! Congrats !!!

  • @volodymyrbarannik179
    @volodymyrbarannik179 3 роки тому +1

    More videos about game design patterns, please!

  • @svenyo
    @svenyo 3 роки тому +1

    This is pure gold!

  • @infinitiom
    @infinitiom 2 роки тому

    Increíble la calidad de tus Videos ! Muchas Gracias por compartir !

  • @user-jp3em3rk6j
    @user-jp3em3rk6j Рік тому

    A really really useful tips , this is so friendly to watch!

  • @iercan1234
    @iercan1234 2 роки тому

    im glad i found this channel, this is really cool!

  • @unreolog8699
    @unreolog8699 2 роки тому

    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.

  • @Th3EpitapH
    @Th3EpitapH 2 роки тому

    you're running a real good channel here man. keep it up

  • @backgroundmusicorg6960
    @backgroundmusicorg6960 3 роки тому +1

    Great Video !! helped a lot with my switch to unreal

  • @StrayVertex
    @StrayVertex 3 роки тому

    Super informative video, thx!

  • @krisitak
    @krisitak 3 роки тому +1

    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.

  • @mikul3122
    @mikul3122 Рік тому

    ty so much for these

  • @TwiejkVR
    @TwiejkVR Рік тому

    dude..... for free? you are a legend

  • @Dayogg
    @Dayogg 2 роки тому

    Thank you, important topic.

  • @cocacola7535
    @cocacola7535 2 роки тому +2

    Sir, how did you make your slides consisting of animated code and diagrams? Using LaTeX `beamer` document class?

  • @l_t_m_f
    @l_t_m_f 10 місяців тому

    Thank you best videos ever!

  • @trampflips101
    @trampflips101 3 роки тому +5

    8:30 I feel like most people are still high on OOP :/ I got a laugh out of that though

  • @VonchkynProduction
    @VonchkynProduction 2 місяці тому

    Thank you for the informative video:)

  • @irtezarahman5370
    @irtezarahman5370 2 роки тому

    You deserve millions subscribers. subscribed

  • @user-gy6cv3ug5i
    @user-gy6cv3ug5i 3 роки тому +4

    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 роки тому +8

      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 роки тому +2

      @@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.

  • @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.

  • @kken8766
    @kken8766 3 роки тому

    i am your big fan now !!

  • @nfrancisj2122
    @nfrancisj2122 3 роки тому

    Great!

  • @Ovicior
    @Ovicior 3 роки тому

    Subbed. Good content.

  • @slimnet04
    @slimnet04 2 роки тому

    vids so good

  • @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 роки тому +1

      @@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..

  • @ajharbeck2075
    @ajharbeck2075 Рік тому

    Would've been nice if he went into more detail on Godot and it's stucture.

  • @thecancermen245
    @thecancermen245 3 роки тому

    good stuff

  • @aaronbrady5237
    @aaronbrady5237 9 місяців тому

    "It's the 90's and we're all high on OOP" lmaoooooo

  • @GraaD-87
    @GraaD-87 3 роки тому +1

    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. =)

  • @jimmytrouble7038
    @jimmytrouble7038 3 місяці тому

    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

  • @yunus5949
    @yunus5949 2 роки тому

    You should keep going to publish new content!

  • @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 .....?

  • @kunyan164
    @kunyan164 2 роки тому

    so cool , i want to know how to make these cool anmations like code animation

  • @3sgamestudio
    @3sgamestudio 3 роки тому +3

    omg I wish that my videos were 1/5 of the professional level of your videos : (

    • @beanboy504
      @beanboy504 3 роки тому +1

      Crazy to see you here! Keep up the good vids :)

  • @ymi_yugy3133
    @ymi_yugy3133 3 роки тому

    I hope this get's simplified a bit with UE5.

  • @manasjoshi2939
    @manasjoshi2939 9 місяців тому

    I wish you didn't stop uploading😔

  • @nicolasgalipeau3632
    @nicolasgalipeau3632 2 роки тому +1

    1337, nice

  • @guyalsfere7470
    @guyalsfere7470 2 роки тому

    "Its the late 90s and we're all high on OOP"

  • @khealer
    @khealer 7 місяців тому

    13:37 LOL

  • @trampflips101
    @trampflips101 3 роки тому +2

    leet video length, even leeter video quality ;)

  • @zeddgamedesigner
    @zeddgamedesigner 2 роки тому

    Unity or Unreal engine?? your opinion.....

  • @SnakeEngine
    @SnakeEngine 2 роки тому

    In Unity you can have child objects. In Unreal only child components. Isn't it limiting?

  • @Western_TV
    @Western_TV 10 місяців тому

    1337

  • @neotrixsine7846
    @neotrixsine7846 Рік тому

    As a Unity user, I understood nothing from Unreal Engine explanation

  • @youngtran8986
    @youngtran8986 2 роки тому +1

    Only thing Epic Game need to put in their "Unity User" document section is this video. The rest is useless.

  • @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.

  • @Manu-wq1io
    @Manu-wq1io 2 роки тому +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.