Array is invalidated and null after Spawning actors

Good Evening.

I’m working on a Projectile Manager for a single player FPS game. I’ve created the Projectile Manager and Intend to spawn the projectile pool in there and reference it inside the weapons while firing.

The idea is I spawn the magazine size of each gun in projectiles and have the projectile movement, collision not active and mesh hidden.

When I fire, I’ll grab index 0 in the array, teleport it to the muzzleflash location and enable everything. After a certain time or upon a hit. The bullet will deactive and return to the world origin and I set the array index of that bullet to the last index to ensure I cycle through the whole array in the event the player rips through the whole magazine.

For some reason, I Spawn the projectiles in the world, which is confirmed with a print string. But when I add it to the array of bullets, it invalidates the data and I get access none errors when i shoot.

I don’t know why the data I’m adding to the array doesn’t work and I hope some light can be shed on the situation. It shouldnt need to be instance editable since its all handling inside the manager. Also I can’t set the data inside the array either as a default?? not sure why. I know it can when its a class reference but I’ve never been able to not set it before as object reference.




make sure the projectile isnt destroyed somewhere else, ie lifespan or destroy on hit

I Thought you solved it with the lifespan as I did set that at one point and it was still there. I forgot to uncheck auto activate which enable physics, which hit stuff and then triggered the destroy etc.

Thanks for your help