/Engine/Plugins/Editor/EditorScriptingUtilities/Source/EditorScriptingUtilities/Public/EditorLevelLibrary.h
Find the references of the material MaterialToReplaced on all the MeshComponents of all the Actors provided and replace it by NewMaterial.
[UFUNCTION](Programming/UnrealArchitecture/Reference/Functions)(BlueprintCallable, Category="Editor Scripting | Dataprep", Meta=(DeprecatedFunction, DeprecationMessage="The Editor Scripting Utilities Plugin is deprecated - Use the function in Static Mesh Editor Subsystem")) static void ReplaceMeshComponentsMaterialsOnActors ( const [TArray](API\Runtime\Core\Containers\TArray)< class [AActor](API\Runtime\Engine\GameFramework\AActor) * > & Actors, class [UMaterialInterface](API\Runtime\Engine\Materials\UMaterialInterface) * MaterialToBeReplaced, class [UMaterialInterface](API\Runtime\Engine\Materials\UMaterialInterface) * NewMaterial )