Q1.i heard someone said “add to array is bad perform when it cause changing array length for allocation”
is this true? then if i know quantity of data(map size), resize array size and set array elem is better way?
because i need update grid based map or pathfind. currently i’m adding data to ‘Set’ or ‘Array’
in future map will be bigger, it could be problem. so i’m afraid i choose wrong way. or miss good way
Q2.i’m using Object Blueprint for each Tile Data storage, should i use Struct? or these two are same?
Thank you for read!
Q1: Adding something to an array is fine. Resizing and the setting, is what adding does anyway.
Q2: Can you be more specific? You use a blueprint when code needs to be run for that asset. If it’s just a definition, then you can use a Struct. They are not the same thing.
Thank you for reply^^
Q1.if i do 10 exc, adding 10 time change array but resizeing is 1 dosent it? In case i do a* pathfinding i’m adding visited tile to ‘closedset’ array more than 100times, maybe i should resize it some big number like search threshhold i think or it still fine?. If i misunderstand sorry for repeat
Q2.i’m using object type blueprint like struct for every tiles profile, like index ,position ,size, state. becasue to modify sturct it should be break and reassemble everytime. I seached alot about it someone said object and struct is same in c++ then why not in blueprint. I guess due to lack in knowledge.
Q1: Adding to an array is a minimal operation, the system just moves a pointer. There’s nothing to worry about.
2: In C++ and blueprint, a struct and an object are not the same thing. If each tile is managing it’s own state, position, size etc - then make it a blueprint. If you are managing all tiles from one central point, then make the tile a structure.