Inheritance Tutorial (Parent Child) | Unreal Engine 5

Поділитися
Вставка
  • Опубліковано 8 сер 2023
  • *Notice Description Contains Affiliate Link
    In this video we discuss an extremely important programming topic known as inheritance. While we focus on how to use Inheritance within Unreal Engine, Inheritance is not something that is sepcific to Unreal Engine, but object oriented programming in general. In short, Inheritance allows you to consolodate common code into a base class, and then derive child classes from that base class, which provides many benifeits, such as not having to re-write code over and over again. Whether you're making guns, npc's, collectibles, doors, buttons, levers, etc. Inheritance will come into play. In this video, we go through an example where we create a pickup system that leverages inheritance. I hope you find this video useful, but if you don't please keep studying the topic by any means nessesary as Inheritance will prove essential to most things you make in Unreal Engine.
    Link To Meshes Used: drive.google.com/file/d/1FHZb...
    Check out some of my other videos:
    Casting Explained: • Casting Explained | Un...
    Blueprint Interfaces: • Blueprint Interfaces |...
    Event Dispatchers: • Event Dispatchers | Un...
    !!Afffiliate Link!!
    Want to level up your learning while also helping the channel? Sign up to skillshare with my affiliate link below, and use code ANNUAL30AFF to get 30% off an annual membership!!
    Link: skillshare.eqcm.net/B0VDaL

КОМЕНТАРІ • 53

  • @Joan-kr1jo
    @Joan-kr1jo 3 місяці тому +11

    Coming from web development, was looking for something like this from the beginning to prevent bloating the project with copy-pasted blueprints. Thank you!

  • @jeffdavies2824
    @jeffdavies2824 2 місяці тому +1

    I've been an O-O programmer since O-O was new (yes, I'm that old). WHat I didn't know was that UE even supported these concepts outside of C++ classes. Thank you for taking the time to help us programmers get on board with UE!😀

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

    Man, your unreal tutorials stand out. Wish you all the best.

  • @b-oshiro
    @b-oshiro Місяць тому

    God, I wish every teacher was this efficient. Thank you!!

  • @elhasaman
    @elhasaman 7 місяців тому +4

    You're truly a master! I been looking for a vod wich explains this programming concept and every second that you explained is legit a great value

  • @julianmillo1459
    @julianmillo1459 4 місяці тому +1

    Thanks for those amazing tutorials. You explain concepts with the greatest clarity!

  • @nikitafff5191
    @nikitafff5191 10 місяців тому +3

    Thank you very much for the tutorial! Now I understand it better. I have to admit that you explain things very clear👀

  • @holychubby8523
    @holychubby8523 10 місяців тому +2

    Thank you for another tutorial. You explain and teach things really good 👍

  • @AliBounds
    @AliBounds 8 місяців тому +2

    Amazing tutorial!

  • @armsandether
    @armsandether 5 місяців тому +2

    Thanks! Really helpful overview and implementation 🦾🦾

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

      Wow thank you so much!! I’m glad you found it helpful!

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

    Wow this was very valuable, as a noob in Unreal Engine I knew I needed something like this but didn't know what it was called. I just found out what it was by pure chance by reading in the blueprint editor and googled the word.

  • @drewbruggman
    @drewbruggman Місяць тому

    Thanks man, just started my first real attempt at a personal project and coming from a java programming background certain things are missing or are obfuscated when using blueprints. Leaning into events seems to be the way to go, and your vid helped me get a grip on how to do that.

  • @hassanalhobail8084
    @hassanalhobail8084 5 місяців тому +1

    I heckin’ love unreal engine! 😄
    I’m getting it! I’m starting to get object oriented programming

    • @luke0812
      @luke0812 4 місяці тому

      this was literally me 2 days ago, haha. It's so satisfying especially as a non coder who is just now getting into it the last few months. It's all starting to click

  • @klausklausberg1646
    @klausklausberg1646 День тому

    If you Can't see the varibales in the Child Actor. Than click on the gear above the varibles section next to My Blueprint. Then click at show inherited variables.
    They seem to have changed this in some UE 5 version so you can't see them by default.

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

    damn, i learned a lot

  • @k.s.8191
    @k.s.8191 12 днів тому

    I like how you explained this in very digestible terms. I'm new to UE5, and wonder if applying a blueprint interface is essentially the same, and if not when one would use that vs a child BP. Thank you.

  • @tommisaksa8063
    @tommisaksa8063 8 місяців тому +2

    Nice and informative tutorial. I missed - why for example the bronze shield is "Data Only Blueprint/Class" and not "normal" child class? I didn't notice you actually set it like that.

    • @TylerSerino
      @TylerSerino  8 місяців тому +3

      Data only classes ARE child classes, that don't have any custom code directly implemented into them. All of the functionality is on the parent, and you simply edit the variables or data. You don't actually "set it" to be data only. If you make a child class of something and don't add any code, it's automatically a data only class - with the exception of the bug i mentioned where you for some reason have to delete the construction scripts parent call to make it show up like that.

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

    Dispatcher could send its message to umg widget or maybe whole blueprint type system ?

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

    thanks for this video, i think i know what I need todo now. i was searching and planning to create a way to use pcg to add blueprints of shelves into shops based on shop type, with items that could be interacted with. individually most of those subjects are covered in various videos, so I was trying to plan and make my own system, but searching for a way to do it in one was not working well. i feel like inheritance was missing from my plan, and if I restructure around this it should work. thanks.

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

    Thanks!

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

      Thank you so much!! Glad to help!

  • @GalaxyVisionAI
    @GalaxyVisionAI 9 місяців тому +1

    I wonder of maybe using an enum in the base class to pick a sound using a select. Then just set the enum in each child.

    • @TylerSerino
      @TylerSerino  9 місяців тому +1

      This is fine if you know exactly what sounds your using and never intend to add more on the fly, otherwise you'd just be making more work for yourself, as you'd have to go in, add to the enum, then add the sound to the select node, rather than just plugging in the new sound to the sound variable. I did something similar to what your describing in a project where we needed an ambient music player. We had our tracklist and it was never going to change so i just had an enum to select which sound.

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

    👌

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

    I have a weird question for you. In my game I have a BP_GunBase. When the player interacts with it the gun will go through a data table with what ever name I give it (instance editable public variable I can change on the children) And out of the data table is the struct that holds all the info of the gun (fire rate, animations, ect ect...) This strut is passed into the player and I add a gun component to the player and pass the strut in there. (So I can have all the gun script in one area) I pass all the info using Blue print interfaces.
    Now time for the question. When ever I change that strut, add/remove variables or change default values, I have to go through and recompile whatever class has that strut. For some reason This also means all the children classes too. Instead of only compiling the parent gun blueprint I need to open every child of that class and compile those too. Completely negating an entire reason I wanted to use this system.
    Any thoughts? Is it because I have the child guns in the level?

    • @TylerSerino
      @TylerSerino  3 місяці тому +1

      Editing structs that are in use can be a pain and usually causes stuff like this, but there is a sort of trick - first, before editing the struct save your work, next edit the struct but do not save anything other than the struct after you edit it. Finally, restart the editor. This usually works for me.

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

    Wanna make a remark that bp_"collect" but vars name with "pickup". For me its little nervous

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

    i love u

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

    I should watch this first time touching blueprint

  • @vishalshaji6382
    @vishalshaji6382 10 місяців тому +1

    Is the game being more optimised for fps with way?

    • @TylerSerino
      @TylerSerino  10 місяців тому +4

      Good question, truthfully, i'm not sure to what extent this effects FPS/Optimzation. I've never noticed one way or the other. It's moreso about making systems that are modular and scalable. But this definitely will prompt me to look into it.

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

      Alrighty :) @@TylerSerino

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

    I have one single main Blueprint class and multiple Blueprint Child for that Parent Class. When a event in Parent Class is run it is directly going to all the child. How to use the event defined in Parent Class to be applicable to only the interacted the instance of BP Child.

    • @TylerSerino
      @TylerSerino  7 місяців тому +1

      It’s effecting all instances of the children in the world? That shouldn’t happen, and by default it should just be effecting the child you’re interacting with. Are you doing something along the lines of “get all actors of class”? I would need to see your code. You can join my discord and message me if you need more help

    • @zest2heed
      @zest2heed 7 місяців тому +1

      Hey Tyler
      Thank you very much for your quick response.
      I have got the solution and the script I designed is working as intended.
      I usually use " get all actors of class" while definition of events and calling them in UI.

  • @AlvaroALorite
    @AlvaroALorite 4 місяці тому

    Something that has become increasing obvious to me the Mir ei learn about UE5, is that you need a solid understanding of the core concepts of OOP (in a language like C++, C# ir Java) before you get to use Blueprints. Or at least it will save you so much time you already have the OOP mindset.

    • @TylerSerino
      @TylerSerino  4 місяці тому +1

      I agree that a solid understanding of those concepts will most likely help significantly. However, for me it was a bit the opposite. I had studied c++ prior to unreal but really struggled to grasp most of the concepts. It wasn’t until I started using blueprints that those c++ concepts became much more clear. I don’t think it was necessarily blueprints themselves, but just the fact that I could see them being applied in an actual setting, rather than through abstract examples demonstrated via a c++ console program.

    • @AlvaroALorite
      @AlvaroALorite 4 місяці тому

      @@TylerSerino oh, kinda like visualizing them right? Makes sense too :)
      Some people are more "language/abstract oriented" others use visual cognitive routes when solving problems

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

    The instanced variable 'Color' is not appearing on 'My Blueprint panel' of 'Base Shield BP'. But can be visible and accessible in 'Class Default' Details Panel. What might be the reason Sir?

    • @TylerSerino
      @TylerSerino  3 місяці тому +1

      Did you turn on “show inherited variables” in that panel?

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

      Ohh Sorry Sir. I wasn't aware. Thank You.@@TylerSerino

  • @ericthunfors
    @ericthunfors 4 місяці тому

    First: I get an "accessed none" error, any ideas what can be wrong? (and second: thanks for excellent tuts!)

    • @TylerSerino
      @TylerSerino  4 місяці тому

      Would need more details, Accessed none typically means you have a variable with no value set that you're trying to do something with. IE if you have an actor variable and you try to plug it into a get world rotation node, but you don't actually have an actor set, itll give you that error. And thank you!

    • @ericthunfors
      @ericthunfors 4 місяці тому

      At 22:13, the get current shield gives me the "accessed" error. I figured that i had not set the shields from the start but i have tried setting it on begin, and in construction. The printscreen shows the set shields, but wont count up if i pick them up. (the collision is working, but gives this error in BP_BaseShield . And thanks again, i really appreciate you taking your time, was not expecting an answer this quick (or at all) @@TylerSerino

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

    A comment for the algo, sir.

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

    It's not the video theme, but why not to use the HUD, instead of print string on every tick ? didn't finish the video, but for first 10 minutes, great explanations, after the finish I will edit the comment =)

    • @TylerSerino
      @TylerSerino  3 місяці тому +1

      In a real scenario you would absolutely use the hud/umg. Just wanted to focus on the topic in this video

    • @Batareika007
      @Batareika007 3 місяці тому +1

      ​@@TylerSerino like and subscribe, need more stuff like it, you did a great tutorial !

  • @TiiAye
    @TiiAye 19 днів тому

    MONTH LONG GAME JAM