Is there a limit to the amount of elements you can have in an array?

I just want to know if there is a limit to how many elements you can fit into a single array and if the type of variable used in the array matters or not.

Hi!

  1. Arrays use int32 as the base for its index, so this constraint is the first one and is architectural

  2. Also as I know there is an upper bound of memory that can be used by one variable. This constraint is physical and depends on element type. To be more precise, it depends on sizeof(element)

hey there, thanks for the reply. So let me ask you something then. Right now im using a system that works like this: I have a BP that does the basic functions i need a set of items to do. Since i need to add a lot of new items and they behave all the same, the only change is visual, like the material they have and the mesh they use, nothing else changes, i decided that rather than make child bps it would be easier for me to make a single array that contained all their visual differences, like the texture i use to represent them in UI and the mesh they have when placed in world. So far i have made 119 of them, which are all in a single array as elements. So what exactly does that mean for my project on the long run? Should i return to the idea of using child bps instead or am i safe using the current system? At first i didnt want to have too many child bps but now… im not sure if i should carry on or re do all of what i did with a new system!

also, another thing i just thought about, whenever i add the icons for the items to my inventory i do a for each loop on them. I havent noticed any slowness of lag or any delay at the beginin of the game before i could control my character tbh, tho i only have 119 individual items as of now using that system so… Im wondering, if i had to use a for each loop with my current system at say, over 1000 items, how would that perform lmao. I mean, even if i wanted to use individual bps for each item, i would still loop through each to add them to my selection screen so… that wouldnt change much at all with what im trying to make right now… it’s just a thought i had about how much of an impact or difference would i feel whenever i were to make the engine loop through over 1k different items, which i guess i’ll eventually add at some point, maybe.

Ok.

  1. So you are wondering which method is the best one (child bp or manager bp)? In fact one method is better in one situation and another method - in another. So, you should decide this based on key features of your project. I think nobody can tell you the answer without some more knoledge of you project.
  2. As for loops - there are several approaches. First of all, loop only if you really should loop. Try to avoid doing this in frequently executed code (Tick func and etc) and cache results if you cant move logic from frequently executed code. Try to use events when you can (add item event, remove item event).

Thanks for the info, so far there are 2 types of constructible objects in my projects, ones that are decor, which use a single bp and just change their appearance and the other type of constructible have certain funcitons like doors and electric system, so far the only thing i have had to use tick for was the electric updates, so its not really heavy at all… So i guess im good with what i have :smiley:

(even made a test super large electric grid and didnt get any lag with the tick updates going on because its just testing if current is passing or not, so its ok the way i have it i guess :P)

The thing is that now im running into a problem that is totally unrelated to what i originally asked, so i hope its ok i can ask for help in the same thread?
For some reason the engine started crashing each time i tell it to make a bp out of selected assets in the world, no matter how many assets or what assets they are… if i place a mesh in the world it just crashes when i tell it to make a bp with it… (im doing it this way cause im trying to make structures that spawn in the world with a certain shape made out of the constructible objects i made. They work well if i make them by hand but the moment i try to compact them into a bp for easier use ue4 just gives up and crashes :c)

Can you picture error log which is showing up at crash? And code/nodes that you are using…