Child actor component and spawn actor

Hi i wanted to understand the difference between Child actor and spawn actor from class

And also how can i give this from blueprint without selecting it manually

Hi i wanted to understand the
difference between Child actor and
spawn actor from class

  • Child Actor is a component that will automatically spawn an actor of the chosen class
  • Spawn Actor from Class just spawns an Actor, there’s no component involved

If you wanted to have an Actor A that owns a bunch of other actors, you’d add (manually through AddComponent dropdown or dynamically, like you do) a component and have it spawn an actor. The best part is that you can change the class on the fly at any point.

Think of a modular actor - a car where every part (wheels, trunk, engine, driving wheel) is a separate actor with unique functionality. You could attach Child Actor Components to sockets on the chassis static mesh of the owning actor. This would allow you to very easily swap out car parts.

The marked CA components above demonstrate this.

And also how can i give this from
blueprint without selecting it
manually

You can store class variables in the same way you store any other variables.

You can have a shop that keeps track of available Actor Classes for sale in an array. The shop shows the list in a widget, the Player buys an item and the Child Actor Component attached to the head socket Sets the Class - and a Helmet actor is spawned.

Hey! I’ve tried using this approach, but if I have a camera on a spring arm, then the child actors interfere with the arm (they block the camera). Is there any way I can make it so that the static meshes of child actors don’t interfere with the spring arm, just like the static meshes of the core actor?

The springarm has a collision channel for its probe, have the other meshes not block it.

1 Like

Thank you very much, this worked. Any chance you could also explain how to make the spring arm follow the child actors position? I’ve tried physics constraint, but it would block child actor movement, rather than have the camera follow the object

Attach Component (Springarm) to Component (Child Actor Component)

This will not work too well if the Child Actor has a will of its own and moves independently of the CAC that instantiated it; in which case, we’d need more details. Consider opening a new thread detailing how things should work and what we’re dealing with.

Thank you for your suggestion. Unfortunately, the child actor does indeed move independently, so I’ve made a separate topic with a detailed description. I’d be very grateful if you could help me with that!