My child actors don't behave correctly


I am working on a controller for VR, which is basically a Static Mesh of a HTC Vive remote controller, and a 3D object in front of it. The 3D object is a child actor that can be changed when pressing a button on the controller. So far, it can be a cube or a cheese. The 3D object should move with the motion controller, since it’s a descendant of the motion controller. The whole controller can also be changed when pressing another button, to switch between a sword and a shield for example.

This is the hierarchy I have :

  • VR_Pawn
    • MotionController
      • MotionControllerChildActor
        • CustomControllerPawn
          • CustomControllerChildActor
            * MyActorBluePrint that should move

If MyActorBluePrint is spawned using the BeginPlay event, everything works as espected. However if wait a bit (or use another event), it is spawned but it’s somehow not attached to its parent, because it’s not moving. GetChildrenComponents on CustomControllerChildActor returns an empty array while it returns a correct array when it’s at BeginPlay, so I think there is something strange. When I change the whole controller, (or when I change the class of MotionControllerChildActor to an another one), the not moving MyActorBluePrint correctly destroyed all the time.

I simplified my script in order to have just a very simple actor, containing a movable StaticMeshComponent without physics and collisions. I attached a screenshot showing it.

What could be the problem? Do you know another solution to do what I want to do ?

Shot in the dark, but the Set Child Actor Class is an extra step so maybe it’s a weird timing issue because the Child Actor is presumably “none” after the game has initialized. You can select the Add Child Actor Component node and in Details panel set the class there.

If I set the ChildActorClass here and remove the set actor class node, it just doesn’t spawn anymore :frowning:

I found a pull request on Github that seems related, but the fix is already integrated in the stable release.

Anyway, I implemented a workaround. I removed all the child actors (they never did good) and used the SpawnActor and AttachToActor nodes instead.