Download

Spawned actors begin play + tick functions not calling

Hey so I’m spawning an actor from the game instance class which when I play in the editor works perfectly fine and returns true and the constructor, begin play + tick functions of the actor all call accordingly.

But when I launch my game, for some reason, the actor spawns in fine and returns true but the begin play and tick functions just don’t call…

The constructor calls but I have no idea why this is happening since it works fine when played in the edtor, please can someone help me out, thank you :frowning:

Code that I used to spawn actor in + never returns null:

GameInstanceActor = GetWorld()->SpawnActor<AGameInstanceActor>(GameInstanceActorClass);

what class does this derive from? As far as I know, all actors will receive BeginPlay(), and any actor that is set to tick will receive tick()…

The actor derives from a normal AActor class and the game instance derives from a normal UGameInstance class.

And yes it does receive begin play + tick when I play in the editor but when I launch it doesn’t

are you sure it is being spawned in game? I think if it were unable to spawn due to something like collision interactions, it would be destroyed before beginplay called…

I thought it would be something like that as well but GameInstanceActor always returns true after being spawned and I even tried using spawn params to always spawn the actor but the actors begin play + tick still doesn’t call when launched:

FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
GameInstanceActor = GetWorld()->SpawnActor<AGameInstanceActor>(GameInstanceActorClass, SpawnParams);

so, use debugger on it and see what GameInstanceActor is there?

1 Like