Actor Component Order

When you add components to an Actor, they seem to have an order, but calling GetComponentByClass (or Components, a node that outputs an array) seems to get components by a random order. Sometimes I get different results in PIE, in Standalone Process and in Packaged.

Any thoughts on this? Or a workaround?

A workaround is to use tags to sort the components:

  • Assign a tag to every UActorComponent or USceneComponent in the actor
  • Sort the GetComponentsByClass result by tag

It’s not very practical but it works…

1 Like