Assertian failed during SetStaticMesh call
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.
Import options I used:
The code snippet I use for setting a staticMesh:
asked Sep 12 '14 at 08:13 AM in C++ Programming
Where are you doing this line:
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.
answered Sep 12 '14 at 08:49 AM
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:
answered Sep 12 '14 at 09:10 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here