WTF Is? Actor Component in Unreal Engine 4 ( UE4 )

Поделиться
HTML-код
  • Опубликовано: 12 ноя 2024

Комментарии • 31

  • @ZimCrusher
    @ZimCrusher 3 года назад +7

    You are BY FAR the most detailed teacher on UE4.
    Thank you for making all these videos.

  • @cinomontague
    @cinomontague 3 года назад +6

    Your tutorials are very quality but the tomatoes in your intro bring Suicidal Thoughts to my dreams.

  • @Cronofear
    @Cronofear 5 лет назад +25

    In the CharJumpComponent example, Mathew uses a casting in order to access an event dispatcher of his Character (Char_ActorComponent). Although this works good it's not implemented in an "agnostic" way, meaning that CharJumpComponent will only work with Char_ActorComponent and will also have a dependency with it.
    IMO when using components it's always good to do it in an agnostic way so we can use this component in many different Actors, ofc it's not always possible but in this case we could use Interfaces. We could create an interface that has two methods: JumpEvent and JumpStopEvent, make the CharJumpComponent implement this interface, and call this interface from "Char_ActorComponent" using the CharJumpComponent reference (in this case, the node "isValid" should be used before the call). And in the case the game needs to replace "CharJumpComponent " with a different component (let's imagine that it's a "CharFlyComponent") in order to change the Character behavior, that's pretty easy. We just need to use an ActorComponent reference to hold either a CharJumpComponent or a CharFlyComponent depending on the situation. Since we're using interfaces, JumpEvent and JumpStopEvent will still be accesible from an ActorComponent reference. Of course, in this example maybe we would need to change the name of JumpEvent and JumpStopEvent to make it more "agnostic" to both Jump and Fly functionality.

    • @lazykid9167
      @lazykid9167 4 года назад

      I also had the exact same thoughts. the method up there is cool , but not agnostic. Your Approach is better, at least as long one stays inside blueprint-world. thanks

    • @Dogmen58
      @Dogmen58 Год назад

      I'm afraid I don't understand. If we were to not use casting, how can we get access to player's "jump" function in component? I can't do it via "Get owner"...

    • @mrwilsonisland1946
      @mrwilsonisland1946 Год назад +1

      @@Dogmen58 Look up blueprint interfaces they are amazing

    • @eobet
      @eobet Год назад

      The bad thing with Unreal Engine though, is that if you put this interface on an actor component in order to extend the behavior of an actor, you can't just call the interface on the actor because it won't be passed on. You must know that the actor has a component that implements the interface and search for it explicitly, which is rather tedious.

  • @johnrex7108
    @johnrex7108 7 месяцев назад

    These have been some very helpful tutorials, man. Well done.

  • @guillermo3dcode
    @guillermo3dcode Год назад

    Great Video! The input part reminds me about how the new enhanced input works 🤔

  • @kevinmalisek9353
    @kevinmalisek9353 2 года назад

    Mathew dude thank you for presenting some actual use cases. Watching this particular video has now finally given me the answer to my problem and I should now be able to create my dream game. Many thanks.

  • @LookItsCollin
    @LookItsCollin 5 лет назад +11

    Your tutorials help me so much.

  • @EmperorKatax
    @EmperorKatax 5 лет назад +8

    ... Extremely useful. It just opened my mind to so many possibilities and approaches thou...
    ... Thanks a lot .... : ),,

  • @DevinDTV
    @DevinDTV 3 года назад

    Another way to do this, and probably the simplest way if I'm not mistaken, is to have the jump input event in the character BP directly call the jump event in the component. So in "Char_ActorComponent" have an "InputAction Jump" node which calls CharJumpComponent's "jump" event, and performs an action on its owner. You could then also have, for example, an NPC which calls its own jump component's jump event, as a result of AI commands or whatever (as opposed to player input).
    This is how I'm handling weapons in my game. The player tries to shoot, player BP checks if they are capable of shooting, then it asks the current weapon component to run its "shoot" event, which performs whatever action that particular weapon does. NPCs can call the same shoot event from the same weapons, but they also run different code on their own end because they don't need to perform all of the same checks a player's bp would (e.g. hitreg/lag compensation etc).

  • @t3hpwninat0r
    @t3hpwninat0r 4 года назад +1

    My game will have a fixed-camera point and click style. If I have "NPC" characters that will walk around and are clickable they will have a lot of events and functions like showing a nametag and highlighting themselves with a post-process outline effect when I mouse-over. The NPC blueprint will be based on the "Character" class which is derivative of the "Actor" class. If I want to add a new type of blueprint, let's call it "Interactable", for static objects like doors and treasure chests they will have most of the same features that I created for NPC for interaction but they should be based on the "Actor" class because they don't need all of the features supplied by the "Character" class like movement, collision, navigation and AI.
    So my question was how do I share events, functions, and variable setup between the two classes in a way that won't force me to edit multiple blueprints exactly the same way in my project every time I add a new game system or fix a bug on these classes? I don't want to make my NPC class a child of the Interactable if it means I have to recreate all of the Pawn and Character functionality myself.
    The answer is Actor Components! All I need to create is a new Actor Component called something like InteractableComponent and put all my functionality in there, then I can just drop this component in any actor I want and now the component has a context in which it can do all kinds of things :D

  • @SymphonicEntertainment
    @SymphonicEntertainment 4 года назад +2

    Mathew, your videos are a godsend. Thank you so much! :D

  • @TronkLSSJ
    @TronkLSSJ 4 года назад +1

    Thank you God for such a great ppl like Mathew

  • @longuemire748
    @longuemire748 2 года назад +1

    Thank you,
    What is the equivalent of dummy in maya or empty in blender?

  • @levioptionallastname6749
    @levioptionallastname6749 3 года назад

    Engaging and relevant, I feel like I Have gotten answers!

  • @christianheimerl9343
    @christianheimerl9343 4 года назад +1

    Amazing work man, keep it up!

  • @ty_teynium
    @ty_teynium 5 лет назад +1

    I could have sworn you had already done this

  • @michaelcasseus2497
    @michaelcasseus2497 2 месяца назад

    Hi Mathew WTF is attach actor to component node HTF do i use the bool value to call the attachment condition without actually using the execution of the attachment between the two as if i already called the ATC node in a macro and now just wanna know HTF to call thay event without attaching again

  • @user47033
    @user47033 3 года назад +1

    I am struggling on understanding when you should use a component versus an interface. They seem very related. What would be the advantage of using a component over an interface?

  • @lululu6102
    @lululu6102 Год назад

    I want to be able to spawn buildings. All the logic should be handled by the individual buildings (enough Money, free space…). Should I use an component or an „Master“ and Child BP? Also I need to store some information about the building (costs, Building Type…) Should this be another component or part of an Master BP of wich every building is a Child of?

  • @JoelDiab
    @JoelDiab 3 года назад

    Love this chanel!

  • @Nashfanfl13
    @Nashfanfl13 4 года назад

    Mathew thanks for the videos great stuff, but for instance if I was making a hierarchy of weapons would it be a component or an actor? A weapon would be part of the player actor? Even after watching still a little confused.

  • @TyLovePie
    @TyLovePie Год назад

    You're a legend

  • @herblewis6250
    @herblewis6250 4 года назад

    If I add a custom actor component it will crash my editor if I set a breakpoint in it, even if it's blank.

  • @arthercasillas2755
    @arthercasillas2755 2 года назад

    Assertion failed: AttachedActor->ParentComponent->GetOwner() == this [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Engine/Private/ActorConstruction.cpp] [Line: 391]
    BP_EnemyShip_Parent_Child_Child . I made a copy of the original BP_EnemyShip. Then from that copy I made a child component, I edited that. Now on the third asset created which is BP_EnemyShip_Parent_Child_Child the copy of the copy i get the error mentioned above.
    Im looking for a solution dont know where to start.
    I have a Capital ship and attached turrets as children.

  • @pawpotsRS
    @pawpotsRS 4 года назад +1

    A bit late but Wtf is? Scene components?