Different Event sequence by AutoPossessAI

I’ve an AI Character with an AI Controller. I found that the order of event sequence will be changed by choosing different method of “AutoPossessAI” in my AI Character blueprint.

If select “Placed in World”, it will execute BeginPlay first then OnComponentBeginOverlap; however,
If selected “Spawned” and the AI Character was created by “Spawn AI From Class”, OnComponentBeginOverlap event will be executed before BeginPlay.

Is this normal? Thank you.

Hey callmeEarly,

I’ve tested this in a clean project by simply printing a string on BeginPlay and OnComponentBeginOverlap with my AI Character’s capsule component and the order for me was always Overlap->BeginPlay according to my output log regardless of whether the AI was placed in the world with Auto Possess AI set as such, or spawned.

Order of operations is never guaranteed though, so if you want a specific event to happen right when something spawns, I’d recommend adding a minor delay to whichever function you’d like to be called second to account for this.

Let me know if you have additional questions regarding this.

Have a great day

got it, thank you for your quick respond.