I’m new to Unreal and I think I don’t understand how null pointers work.
In my lvl I’ve got a door that’s opening and I want to add a sound to it. I made all needed declarations in .h file:
#include "Components/AudioComponent.h" UPROPERTY() UAudioComponent* AudioComponent = nullptr;
The problem is, when I try to find my sound with
AudioComponent = GetOwner()->FindComponentByClass<UAudioComponent>();
If I do it with BeginPlay() on the start of the game, it does well and find my sound. but when I do it with TickComponent(), to check each frame if the door is close/open I get AudioComponent == nullptr.
So basically the question is why when I start the game I find the sound but I can’t find it in each frame?