I am unable to see in the game spawned actors with paper 2d sprites when they are spawned, if I eject out of the game and edit properties the property suddenly shows. I’ve attempted to try and edit properties post spawning. All of the properties are initialised in a blueprint.
Before editing a property when actor is spawned.
After editing a property when actor is spawned.
This is the code that spawns it - apologies for it being messy I’ve been trying this for several hours…
Defaults
PrimaryActorTick.bCanEverTick = true;
SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComp"));
SetRootComponent(SceneComponent);
paperSprite = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("PaperSprite"));
paperSprite->SetupAttachment(GetRootComponent());
paperSprite->RegisterComponent();
Asteroid Spawner.
void AAsteroidSpawner::SpawnAsteroid()
{
FVector spawnLoc = FVector(0,0,0);
FRotator spawnRot = FRotator(0,0,0);
FActorSpawnParameters params = FActorSpawnParameters();
params.bDeferConstruction = false;
params.Owner = this;
AAsteroid* asteroid = GetWorld()->SpawnActor<AAsteroid>(AsteroidClass, spawnLoc, spawnRot, params);
//asteroid->paperSprite->SetSprite(AsteroidClass->sprite);
asteroid->UpdateComponentTransforms();
}