Issue with engine class

Hello,
I am facing an issue with one of the class from the UE4 source.
The problem is the following :
I am using a build source of 4.26.
In my project, I have a class name MergeMesh.cpp. In this class, I prepare everything for the merge mesh and call the function DoMerge (giving good parameters) that is defined in the SkeletalMeshMerge.cpp file of the UE4 source.
Everything is working well. When testing in the editor, I see the meshes correctly merged and have no error.

I packaged my project (the linux dedicated server and the windows client). And then launch the server and the client. After connecting to the server, I do several action and then do the part of the code I mentioned before. And I have now a big issue in my merge mesh :
“Assertion failed: false [chemin…/SkeletalMeshMerge.cpp] [Line 202]
Invalid number of UV sets. Must be between 0 and 4”
And then it cause the game to stop. (signal 11 caught)

So, I look into the code and this error is causing by GENERATE_LOD_MODEL (inside the UE4 source code, the file SkeletalMeshMerge.cpp). This function is called by the DoMerge that I called in my code.

#define GENERATE_LOD_MODEL( VertexType, NumUVs ) \
{\
	switch( NumUVs )\
	{\
	case 1:\
		GenerateLODModel< VertexType<1> >( LODIdx + StripTopLODs );\
		break;\
	case 2:\
		GenerateLODModel< VertexType<2> >( LODIdx + StripTopLODs );\
		break;\
	case 3:\
		GenerateLODModel< VertexType<3> >( LODIdx + StripTopLODs );\
		break;\
	case 4:\
		GenerateLODModel< VertexType<4> >( LODIdx + StripTopLODs );\
		break;\
	default:\
		checkf(false, TEXT("Invalid number of UV sets.  Must be between 0 and 4") );\
		break;\
	}\
}\

So, for some reason that I don’t now, I end up in the default section. But the thing that I don’t understand is the “between 0 and 4”. Here we can see that 0 is not possible in the switch… So it is an error from UE ? I think the message should be 1 and 4.

But anyway, in all case I don’t know why I am getting this issue since I don’t have it in the editor.

To do some other tests, I do a windows server too, and test. I don’t have the error…

I tried to understand the code of SkeletalMeshMerge (and I understand well what is happening I think) but not why I have the issue.

Have you any ideas of what I can do ? Even if you are not sure…
I am totally lost and desperate right now…

Thank you to everyone that take times to read this message.

All the best

Ok, so I think between 0 and 4 was an error. It should be between 1 and 4.

The problem is linked to the dedicated server. A dedicated server can’t render anything. So before the code I mentionned, there is some function that are linked to rendering. The server is unable to execute them correctly and unable to have the correct NumUVs here.
I print the NumUVs for server and client and for the server it is always 0 and for the client something between 1 and 4.

I added a If (!IsRunningDedicatedServer()) just before the line "MergeMesh->AllocateResourceForRendering; in SkeletalMeshMerge.cpp file.
You should close the if just before the if(!ProcessMergeMesh).

It works for me, but not sure it is the best solution.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.