Get all actors from class changes

i’m working on a maze generator and i made a function that finds the neighbors of a cell and returns a random neighbor (i have a one dimensional array so i used a i+j*cols equation, and each time i add or subtract 1 from I or J), if i give it 10 as the current cell and tell it to destroy all of the neighbors and its own floor, it destroys the floor of the most left cell second from the top, and the neighbors of the highest cell second from the left. do you have any idea why? my nodes are really messy so it won’t help if i upload them to here, so even some ideas why it happens will help.

get all actors from class changes

This node does not guarantee element order. See here:

https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1695661-get-all-actors-of-a-class-not-indexed-in-proper-order

Suggest for mazes to use a vector map with cells as the variables, it works great for a grid-like system like a maze.

As Everynone said there no guaranty of proper order in “get all actors from class” node, you should track positioning yourself, make your own array. If you spawn runtime, put them in array yourself right away, if you place grid on level use cell position information to know where emplace the object. You can use map instead of array, you might find it easier to use in this case.

I successfully implemented this very thing, a random maze generator, by first running all the calculations and maze generation on the array until it’s all done creating all the data points of which cells should have walls on which sides.

AFTER all of that is done, then I feed that resulting array into a function that spawns the actors for each tile of the maze, and its walls. So the actors that form the floor and walls of the maze don’t even exist until the maze has been generated/designed as data in the array.

No actors are involved until the maze data is already set.