Announcement

Collapse
No announcement yet.

Can we have a function like UChildActorComponent->SetChildActor(AActor*) ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [PROGRAMMING] Can we have a function like UChildActorComponent->SetChildActor(AActor*) ?

    Hello,

    i want to spawn a NAMED Actor via a ChildActorComponent

    When i use this function: SetChildActorClass

    ChildActorComponent->SetChildActorClass(ActorClass)

    The ChildActorComponent will spawn an actor with the given class but i have no control on the actor name that will be spawned

    I would need a function like: SetChildActor

    ChildActorComponent->SetChildActor(Actor)

    that will spawn an Actor with a name i could have set before (maybe with the help of SpawnActorDeferred or with a spawned actor that i will attach to the ChildActorComponent using SetChildActor)

    Thanks

    Last edited by skeleton60; 09-08-2017, 10:18 AM.

    #2
    You could subclass UChildActorComponent and put your SetChildActor() function here, looking at UChildActorComponent::CreateChildActor() implementation in order to properly attach the child actor. However it looks like UChildActorComponent has been made to have complete control of the created child actor, so are you sure you need to create your child actor externally? Probably a better design would be to let UChildActorComponent create your child actor.
    Last edited by eyosido; 09-09-2017, 09:14 AM.

    Comment


      #3
      Thanks i will do this, i am new to ue4/c++ and i didnt even think bout subclassing uchildactorcomponent

      Comment

      Working...
      X