Date
July 18, 2024
Hours
0.75
Tags
UnrealCodeC++LETSGO
So I was trying to figure out the following:
// h
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly)
TSubclassOf<AAudioPlatform> BP_AudioPlatform; // set in editor
// cpp
AAudioPlatform* SpawnedPlatform = GetWorld()->SpawnActor<AAudioPlatform>(BP_AudioPlatform, Location, Rotation, SpawnInfo);
Tsubclassof would keep returning null.
Turns out it’s because I am spawning the parent AudioPlatformSpawner, when I need to spawn a BP_AudioPlatformSpawner, which would contain the value BP_AudioPlatform set in editor.
Didn’t have time to fix the issue in the morning, but I know how to fix it, maybe another 30 minutes to fix the platform spawning.