UE4 With Casey - Parent-Child Classes

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ม.ค. 2019
  • Today I show how we can leverage parent/child relationships.

ความคิดเห็น • 31

  • @LastNight0
    @LastNight0 ปีที่แล้ว

    your a wicked mad man i tell ya! i cannot even begin to say how informative and how literally nobody on youtube teaches this stuff but you... i wish i could shake your hand

  • @peterpetertorres
    @peterpetertorres 3 ปีที่แล้ว

    Thank you so much for this. I was looking to better understand using parent/child classes with data tables and you summed it up perfectly.

  • @ReginaldusGaming
    @ReginaldusGaming 4 ปีที่แล้ว +1

    I couldn't find a video like this anywhere...and for that alone I thank you. Keep up the great work!! I subbed, liked and will be checking out your other videos

  • @sovereignfrost163
    @sovereignfrost163 3 ปีที่แล้ว

    Oh my god, thank you so much. Some tutorials show you the incorrect way of using these and this really helped me for my college project!

  • @ue4withcasey391
    @ue4withcasey391  5 ปีที่แล้ว +3

    My mistake, the custom event override was there- I'm just blind.

  • @robertdemka4110
    @robertdemka4110 5 ปีที่แล้ว

    Nice dude, very helpful

  • @masterfar35
    @masterfar35 2 ปีที่แล้ว

    SUPER THANKS!

  • @Video-by6lp
    @Video-by6lp 3 ปีที่แล้ว

    Thank you very match !!!

  • @savit3r
    @savit3r 3 ปีที่แล้ว

    Am the 100 liker, sooooooo good tutorial

  • @AmuroGameDev
    @AmuroGameDev 3 ปีที่แล้ว

    thank you!!!!!!!!!!

  • @mongmong4519
    @mongmong4519 3 ปีที่แล้ว

    Thanks

  • @robertperly6104
    @robertperly6104 5 ปีที่แล้ว

    Thanks goodinfo

  • @Kokosko
    @Kokosko 4 ปีที่แล้ว

    When i use the event method in my multiplayer game, they don't get replicated when i use the Move event from child even tho the event is multicast and called from a different blueprint that has an authority check.

  • @sleepyjoe5380
    @sleepyjoe5380 ปีที่แล้ว

    Great tutorial, just slow down a bit.....A slide show would be great

  • @bignekidbatzero
    @bignekidbatzero ปีที่แล้ว

    holy shit it was that simple for hours 2:00

  • @NinjaThug
    @NinjaThug 3 ปีที่แล้ว

    Great content! Thanks for this! Liked and subbed! Although I'd like to suggest that you'd go a little slow for noobs like me. :P

  • @ZimCrusher
    @ZimCrusher 3 ปีที่แล้ว

    This was super helpful, but I was looking for something slightly different.
    Putting child actors into another blueprint. Lets say you create a button actor, and then create a crate that needs buttons to open it.
    Adding the button blueprint as a child inside the crate bluprint, and then you have a bunch of buttons that all act the same, and don't need to recoding everything.
    but...... How do you get those to talk to each other?
    How do you get say.... buttons to all be part of a single array, that says button 1 and 4 have been pressed, so the crate can now open?
    Because it does not look like you get any access to the variables when you add a child inside a blueprint.

    • @fivefive9638
      @fivefive9638 2 ปีที่แล้ว

      The button wouldn't be a child of the crate, since the button and the crate don't do any of the same things. If you want to get things to talk to each other learn about Blueprint Interfaces.

  • @espada9973
    @espada9973 5 ปีที่แล้ว

    My game has multiple characters that can be used by the player, so I made a parent character where it does all the movement, health, and other mechanics; then I made children for all the characters, and they share the same code, all functioning and that's really cool.
    One problem is that now I don't know how to refer to the specific character I'm using, with just referencing to his parent.
    Let's say I want to display my characters health in a hud. Inside my HUD class I cast the character parent, and from there I don't know how to progress to get the health of the specific character I'm using.
    If I get the health from the parent it does nothing. I could cast the specific child but it would defeat the purpose of having one, because then I have to do that for every child.
    Please help me.

    • @ue4withcasey391
      @ue4withcasey391  5 ปีที่แล้ว +3

      Any variables that are held by a parent get used by children. So in your example, we have our "parent player" that has a variable for health. If we create a child called "child player." It will have that health variable. Through gameplay, if we get an actor reference to our player we need to cast it like you said. If you need access to variables or functions specific to the child (not held by parent) then you obviously need to cast to the child. But if all we need is something like his health, we can cast to the parent class. There should be 0 issues grabbing the health of the child through an object reference that is casted to the parent.
      To simplify your specific use case, I do "huds" only inside of widgets (i dont use any of like the hud classes or whatever, they seem to add extra complexity for no functional purpose). Inside the widget we can create a variable for the Player Parent and make the variable instance editable and expose on spawn. So on begin play of your character, you can create a widget for the hud and add it to viewport. When you punch in the HUD in the create widget node, you will see that an input pin gets created for that variable we made. Now just use a reference to self and connect it. This means that on creation, your hud will know who the player is.

    • @espada9973
      @espada9973 5 ปีที่แล้ว

      @@ue4withcasey391 Wow, thanks for such detailed response :)
      I think I have done like you said, casting to parent, that holds all variables I need, and the child just has custom values of those variables.
      Then I add a widget to the viewport inside my character parent, which is my hud. It displays in game, but it's blank. For example the health bar instead of being at 90% by default is at 0 and does move when I perform actions to increase my character's health. I think there's something wrong about it picking up the information about my current character.

  • @mademade5939
    @mademade5939 5 ปีที่แล้ว

    Do you have discord channel sir,
    Or maybe i can ask here....i always wondering how to make multiple health system( a health with maybe 100bars of HP) because normally other tutorial only show the basic kind of HP bars

    • @ue4withcasey391
      @ue4withcasey391  5 ปีที่แล้ว

      No discord channel, sorry.
      I recently designed a health system where it was 4 bars of 25 hp and you would only regenerate the current bar. For example, if you are at 40 HP you would only regen up to 50. Is that what you mean?

  • @liubomyr5050
    @liubomyr5050 4 ปีที่แล้ว

    Hello. My game has multiple characters that can be used by the player, so I made a parent character where it does all the movement, health, and other mechanics. I've made one special animation of entering the room using Sequencer. As a character that is entering the room I use my parent character. But how can I change it to children?
    All characters must play same animation when they enter the room. I know only how to spawn Actor from Class, but how can I use it inside sequencer when the character is already spawned?

    • @ue4withcasey391
      @ue4withcasey391  4 ปีที่แล้ว

      My first question would be, what is different about your characters? Is it just visuals?

    • @liubomyr5050
      @liubomyr5050 4 ปีที่แล้ว

      @@ue4withcasey391 right. Only visuals

    • @ue4withcasey391
      @ue4withcasey391  4 ปีที่แล้ว

      @@liubomyr5050 I personally wouldn't use child classes then. Especially with your use case, I would just change the mesh that your actor is using in code to switch between characters.

    • @liubomyr5050
      @liubomyr5050 4 ปีที่แล้ว

      @@ue4withcasey391 I thought about doing that. But there are also widgets for each character which contains character name and characteristics. Widgets must be created when character enters the room.
      Of course, I could just create logic: if one player enters the room, create one widget; when another one enters the room, create another widget. But is there the way to automate that?

    • @liubomyr5050
      @liubomyr5050 4 ปีที่แล้ว

      ​@@ue4withcasey391 Should explain something? Is it clear?