Getting ‘Accessed none trying to read property’ when trying to change the materials of static mesh component objects that are stored in an array
Hi everyone, I have been having an issue where I want to change the materials of the cones that a blueprint has spawned through an Add Static Mesh Component node. All of these cones have been placed in an array that can be accessed elsewhere (for this case, the level blueprint). In the level blueprint, it is supposed to get the array of cones and then, for each of the cones, alternate its material between green and white. I seem to be having two problems, the first being that the array of cones gets larger and larger every time I make a change to the blueprint in the level.
The second being that ingame, the message log fills with so many errors it almost brings the engine to a halt. The errors are as stated in the title of this question. The cones also don't change colour either. I've had this issue numerous times over several occasions where I have tried to do something similar to this but I have never been able to figure why it happens. I was hoping someone here would know. So if anybody here knows why this happens, it would be much appreciated if you could tell me.
The object or property you're trying to access is either not initialized yet or is being garbage collected. Use the "IsValid" macro for the object or the property prior to using it in your logic. This will stop the logic (and those errors) if what you're trying to access is not actually available.
Your loop on tick also confuses me, tick is triggered every frame. There's no reason for you to re-loop everything manually.
Follow this question
Once you sign in you will be able to subscribe for any updates here