Hello!
I ran into an issue where OnComponentBeginOverlap fires before BeginPlay starts on a spawned pickup actor.
I have a character with a collision sphere that detects pickups and automatically collects them on overlap. This works fine for normal pickups that spawn in the world.
However, in one case I need to spawn a pickup inside the character’s collision sphere, but I don’t want it to be picked up immediately. I want it to only be collectible after it exits the collision sphere and reenters it.
My problem is: I have a boolean variable in the pickup to see if I can pick it up (default = false). In BeginPlay of the pickup, I set this boolean to false again (just to be sure). But when the pickup spawns inside the sphere, the character’s overlap event fires first, before BeginPlay of the pickup has executed. When the character checks that boolean on the pickup, somehow it reads as true, even though the default is false and I’m setting it to false in BeginPlay. So the pickup gets collected instantly.
I also have an End Overlap event, that sets thd boolsan to true, so that I can collect it later.
Thanks in advance!