How to reference components added at runtime
Hi, I'm working on a infinite runner-like blueprint that adds static mesh components to itself at runtime along a random generated spline. I want to delete the components that are behind the player position therefore I store all the added static mesh components to an array of structs that have a static mesh component reference and its distance along the spline:
Then every tick i check at what distance along the spline the player is and delete all the meshes that are behind:
But I always get a Accessed none trying to read propriety Static Mesh_blablabla on the "Set visbility" node. Am i storing the components in a wrong manner? The components are there because I can read the distance and the name of the component. Can anyone tell me if I'm missing something?
asked May 11 '19 at 11:11 AM in Blueprint Scripting
Also, here's a quick alternative since that should be quite performant and suitable for infinite runners. It does not rely on indexing and is event driven. It may not fit with your game design / concept though. I'm gonna leave it here in case you want to experiment:
The player has an overlapping volume behind them:
And each tile fires onEndOverlap if it collides with the player.
No casting, no Ticking, no arrays, no indexing.
Follow this question
Once you sign in you will be able to subscribe for any updates here