Q:

RemoveAt from StructArray Ue4

I struggle a bit with deleting struct from my TArray of structs.My struct contains AudioComponent and float.I was using Array.RemoveAt(index), but what i got from this was only removing half of my struct, which is AudioComponent.
Why is that? My function Removing elements looks like this:
void RemoveArrayElement( UAudioComponent AudioComponent )
{
    for( int i=0; i<Array.Num(); i++ )
    {
        if( AudioComponent == Array[i].AudioComponent )
        {
            Array.RemoveAt( i );
        }
    }
}

What i want to achieve is completely deleting index, AudioComponent with it's float.

A:

There are few issues with your code. As others mentioned in comments, you should use pointers. And if I'm not mistaken, you aren't allowed to use construction like this:
UPROPERTY()
    TArray<UAudioComponent> invalidArray;

You should use UPROPERTY macro, otherwise your properties could and probably will be garbage collected. UPROPERTY wiki. 
Next thing is that you are changing array over which you are iterating. I wrote few approaches, let's look at them:
void RemoveArrayElement(UAudioComponent* AudioComponent)
{
    TArray<UAudioComponent*> audioArray; // array will be initialized somewhere else, this is for demo purpose.

    // you always should check your pointers for validity
    if (!AudioComponent || !AudioComponent->IsValidLowLevel() || AudioComponent->IsPendingKill())
        return;

    // Correct approach 1 (multiple):
    TQueue<UAudioComponent*> toDelete;

    for (int i = 0; i < audioArray.Num(); i++)
    {
        auto item = audioArray[i];
        if (AudioComponent == item || true) // we simulate another condition for multiselect
        {
            toDelete.Enqueue(item);
        }
    }

    // better approach for iteration:
    for (auto item : audioArray)
        if (item == AudioComponent || true) // we simulate another condition for multiselect
            toDelete.Enqueue(item);

    // finalize deletion in approach 1
    UAudioComponent* deleteItem;
    while (toDelete.Dequeue(deleteItem))
        audioArray.Remove(deleteItem);

    // almost correct approach 2 (single) :
    UAudioComponent* foundItem;

    for (auto item : audioArray)
        if (item == AudioComponent)
        {
            foundItem = item;
            break;          // we can skip rest - but we must be sure, that items were added to collection using AddUnique(...)
        }

    if (foundItem)
        audioArray.Remove(foundItem);

    // correct and the best - approach 3 (single)

    audioArray.Remove(AudioComponent);
}

