Add objects to a place in a TArray

Hello
I would like to know how do you make an TArray that contains 20 empty slots and then be able to add actors to those slots. I have been using:
ItemInventory[slot number] = Actor. But when i started to use Actor.Destroy(); this method don’t work.
Thanks for any help!

You can make array with static allocation array by adding TFixedAllocator to template

TArray<AItem, TFixedAllocator<20>> ItemInventory;

In items override OnDestroyed() and make it inform inventory menager that item gets destroyed and make menager remove it’s inventory entry (by setting to nullptr), or make Item do that himself.

Okay but how should I do to be able to add a actor to the array at a set position and then call destroy on the actor that is in the world? I have figured out that when I add the actor to the array it doesn’t add a copy of it, it refers to it. So every time I call destroy on the item that is in the world it disapears from the array