I’m building a level that has different types of resources; trees, ores, etc. yup, same thing different day.
Except that I didn’t want to use GetAllActorsOfClass() every time I wanted my mining bot to search for local ore sources.
So I created a function that could be run as a utility by me (not in game) to read all of the resources, and add them to a DataTable. Next I was reading that using multiple DataTables is better then one with a lot of rows.
The reason for the dataTables is when the the player instructs the mining bot to go get me all of the copper, the bot reads the DataTable, copies all of the copper nodes to an Array, then gets the closest copper node out of the array.
After the bot mines the copper node, it destroys the actor and removes the element from the array.
Or It hides the actor, removes the element from the array, and sets an internal timer so the ore can respawn.
I also looked at Data Assets too.
Am I going about this correctly? Should I have 1 huge dataTable that lists all of my resources? It could get big really quick.
Or just at the beginning of the game, do the GetAllActorsOfClass(), copy the Vector Locations to the array(s) and be done with it.
I assume I’m not the first guy to do this.