Inventory Theory: Attach or Destroy?

I have several AActor* - Variables inside my Character class. Each of them functioning as an Inventory Slot.

Now my question is, how should I proceed when picking up an Actor?

One Method would be to save the Pickup-Actor in one of the inventory slots, attach the actor to the Characters RootComponent, make it invisible and disable its collision. But then the Character would carry this Actor with himself all the time (even though the Item is invisible). Would this still be performant with a Server of say 64 People, each of them carrying several Actors around?

Another method would be to Destroy the Item-Actor and store all its unique variables in a String or something. The downside of this would be, that I couldn’t access things like its InventoryPicture-Texture (stored in the Item-Actor) on the fly anymore.

What do you think would be the best approach? Or is there another better method that I didn’t think about?

Thanks in advance

First metod is what Unreal (the games) been using and you don’t need to make things invisible, you can destroy mesh component and reconstruct if needed. Actors are practicly just collection of components, empty Actors don’t take much of prefremence, the components is where the juice is.

That was very helpful and works like a charm. Thanks Shadow!

If someone is still reading this… I managed to delete the StaticMeshComponent by doing “StaticMeshComponent->DestroyComponent()”. But how do I reconstruct that component again? Thanks

IF not you can try to hide and unhide the component

Thanks again, . I couldn’t quite figure out how to use the “AddComponent”-Function, as for the confusing parameters.

Hiding/Unhiding however works great. Though I hope the performance won’t suffer from this because the components are still “existent” in the world.

Thanks!