How to remove lod automatically?

I would like to remove specific lod automatically, but all I found is a node called ‘Remove lods’…which deletes every lod without lod0. It’s there an way to delete specific step of lod? Such as deleting only lod2…

Hi baikgyul,

There’s no way AFAIK to do that from Blueprints.

I’ve got a c++ tool on the marketplace that does that and more (eg insert LODs etc) and can be applied to bulk static meshes at once if that’s any use?

2 Likes

Ah, if I have to use C++, then it’s fine :sweat_smile: Thanks for recommending this plugin!!

Found own solution,

BlueprintLibrary code that can delete lod index…

void ULODBlueprintLibrary::RemoveCertainLOD(UStaticMesh* StaticMesh, int LODindex)
{
	
	if (StaticMesh != nullptr) {
		const int NumLODs = StaticMesh->GetNumLODs();

		

		if (NumLODs > 1 && LODindex > 0 && LODindex < NumLODs) {


			UAssetEditorSubsystem* AssetEditorSubsystem = GEditor->GetEditorSubsystem<UAssetEditorSubsystem>();
			bool bStaticMeshIsEdited = false;


			if (AssetEditorSubsystem->FindEditorForAsset(StaticMesh, false))
			{
				AssetEditorSubsystem->CloseAllEditorsForAsset(StaticMesh);
				bStaticMeshIsEdited = true;
			}

			StaticMesh->Modify();
			StaticMesh->RemoveSourceModel(LODindex);
			StaticMesh->PostEditChange();

			if (bStaticMeshIsEdited)
			{
				AssetEditorSubsystem->OpenEditorForAsset(StaticMesh);
			}

			
		}
	}


}

If it causes LIK2019 error, add dependency ‘UnrealEd’ to Build.cs

2 Likes