Download

Do uninitialized variables still take up memory? [Answered]

Ex: Lets say I have 1000 enemies (same class) in the scene and only 20% of them need an audio component.

If I add UPROPERTY() UAudioComponent* SoundStuff; to the class but leave it empty for 80% of them, will they all still reserve the memory for that audio component?

Or will all the objects relatively stay the same, and only the ones who get the AudioComponent initialized increase in memory/complexity?

Thanks

It will only require space for the empty pointer on each enemy, so 8 bytes each.

Excellent, thankyou!