I am new to Unreal Engine and have been trying to learn to use it with my existing knowledge of C++. I initially ran into issues with any blueprints I created that inherited from C++ classes losing their inheritance and becoming invalid after closing and opening the project, along with visual studio sometimes being completely unable to find either the object source files or the engine files.
I turned off live coding and am instead trying to build in visual studio directly. Whenever I try to build my project in visual studio however, I receive the following error: “MSB4018 The “SetEnv” task failed unexpectedly.”
I have been trying everything I can to solve this, including repairing visual studio and reinstalling UE 5, but so far nothing has worked. I feel like I must be missing something obvious because there is no way this is a normal thing.
Does anyone know what might be going on here? So far the C++ side of Unreal Engine has not worked since I downloaded it. I am happy to provide additional information.
Hi @Seanny_D ,Welcome to the forum!
Great to see you jumping into the world of Unreal!
I did some searching and found a few posts where other users reported the same error you’re getting (MSB4018 SetEnv task failed unexpectedly), along with some potential solutions that worked for them.
Okay thank you for finding this thread, after digging through it the solution that worked for me was going into the Unreal Engine Integration Configuration that opens when you start a UE project with C++, then setting Max Include Path under the Unreal Build Tool Configuration to something less than 32k (I did 20k), then clicking regenerate the current solution and apply Unreal Build Tool Config, closing VS, opening the project back up and rebuilding, then going in and using the unreal engine editor.
I think the error may have initially popped up again when I rebuilt it… but since then I have built the project multiple times in VS after making changes to test if it was working and all the builds have succeeded without error.
Also I greatly appreciate the extra C++ resources.