4.17 Instance static mesh wrong index when removed
When I moved my project to 4.17 I realize that instance static mesh stopped working. It seems like invalid index is returned if one of the instances are removed. It only happens for specific instances.
Workaround is to initialize all instances: Remove Instance, Remember all instances, Clear Instances, Add all instances.
answered Sep 24 '17 at 03:18 PM
This is because each time you remove an item, the total array of those instances is re-sized. So if you have 50 blocks there and the first one is "0", if you remove that "0" the next block in line will then become the new "0" and the total array will become 49 instead of 50. I am dealing with a bug caused from this same issue.
In my game, a player can mine ores. Lets say there are 5 iron ore nodes on my map. If a player mines an iron ore, my code properly removes that specific iron node from the game for 20 seconds. After 20 seconds, the iron ore respawns. If I wait for the ore to repsawn before I mine another ore, the whole process works fine, but if I mine an ore while waiting for another ore node to respawn, it will remove the wrong ore node or not remove one at all because the array has been changed from its original state.
I have no idea on what a workaround would look like, but that's the problem.
Follow this question
Once you sign in you will be able to subscribe for any updates here