Project cannot compile during packaging - No such file or directory - but can run game and build from VS2022

MaterialFactoryNew requires the module UnrealEd which is an editor only module.

This thread might be of help regarding getting UnrealEd in a packaged project up and running

Also try replacing the angled brackets with double quotation marks as in the unreal documentation

include “Factories/MaterialFactoryNew.h”