While calling SetStaticMesh in my C++ code I receive assertions like this for several of my fbx files:
Engine\Source\Runtime\Core\Public\Containers\Array.h(536): Assertion failed: (Index >= 0) & (Index < ArrayNum)
Array index out of bounds: 8 from an array of size 5
In my use case I need to import the fbx file at runtime without combining its meshes. They are about 1000 meshes, not 5 as the assertion suggests. This fbx file is already imported in the Editor, all 1000 static meshes are shown in the Content Browser and by selecting them all and drag&drop them into the scene I can see the model.
I want to reach the same effect when loading the assets from C++ code.
It will need to be in the constructor which I’m assuming your doing as your also using the PCIP. Also, “8 from an array of size 5” may be due to the “getComponentAtPos(i)”, what can your ‘i’ variable go up to, it may be that it is trying to access a component that doesn’t exist.
Yes, the code is inside the constructor of a subclass of AActor. The i variable can go from 0 to the total size of the meshes inside the fbx file which are hundreds.
Inside the the class I have a class member variable m_meshes of custom type FSubObjStruct which allows me to manage subobjects in a TArray: