Read this if you want to use runtime meshes on mobile devices.
Creating meshes that may change during runtime is what I wanted to try. (personally, I believe this sort of functionality is extremely useful).
I was playing with ProceduralMesh and RuntimeMesh plugins, and in my experience ProceduralMesh is a way slower than RuntimeMesh, it is clearly seen on slow devices.
The unfortunate thing is that collisions and physics do not work on mobile for both of them. Someone decided for me that runtime cooking kills performance, and cut it out for Android. That was really ******* me off. I wanted to see collision with my meshes and I can’t. Motherf*s!
I did some digging it looked like all I need is to uncomment one line (“PhysX3Cooking{0}”) in PhysX.Build.cs and set bRuntimePhysicsCooking to true in UEBuildAndroid.cs. Well, it did absolutely nothing, except making linker to complain about some missing dependencies.
So, after a series of experiments I actually found a way.
Download engine source. (do as manual says: download; make sure that environment variables ANDROID_HOME, ANT_HOME, JAVA_HOME and NDKROOT are set properly; run Setup script; run GenerateProjectFiles script). One more thing of advice here, set the engine on a drive that has at least 100 GB of free space on it.
Engine/Source/Programs/UnrealBuildTool/Android/UEBuildAndroid.cs: set bRuntimePhysicsCooking to true
Engine/Source/Programs/AutomationTool/Scripts/BuildPhysX.Automation.cs: comment the line with [RequireP4]
Engine/Source/ThirdParty/PhysX/PhysX.Build.cs: uncomment the line containing “PhysX3Cooking{0}” for Android
Engine/Source/ThirdParty/PhysX/PhysX_3.4/Source/compiler/cmake/Andorid/CMakeLists.txt: uncomment INCLUDE(PhysXCooking.cmake)
Run Engine/Source/ThirdParty/PhysX/GenerateProjects_UAT script with TargetPlatforms set to Android, SkipBuild disabled
Build the Engine
After that games created with your own build of the Engine will support collisions and physics with runtime meshes on mobile devices.
In my test app mesh rebuild happens relatively rare: twice every second. With collision overlap events enabled I do not see any drop in performance.
Finally, at peace.