So I’ve got a python script that loads a bunch of .fbx models into UE5, each has an associated text file to indicate whether it should have nanites switched on.
My question is: for the ones that require it, how do I switch on nanite generation using python?
Thanks in advance.
Because this thread show in Google Search with following keyword
unreal engine python nanite, I will leave answer here for other to discover.
Here is my Python code to enable Nanite on StaticMesh.
This is the code that I write in UE5.0.3.
static_mesh_editor_subsystem:unreal.StaticMeshEditorSubsystem = unreal.get_editor_subsystem(ue.StaticMeshEditorSubsystem)
for static_mesh in static_mesh_list:
nanite_setting:unreal.MeshNaniteSettings = static_mesh_editor_subsystem.get_nanite_settings(static_mesh)
nanite_setting.enabled = True
static_mesh_editor_subsystem.set_nanite_settings(static_mesh, nanite_setting, True)