Cannot create C++ Class - Failed to read template file

I have been working through the Unreal C++ Dev course without a hitch, but have hit an issue on section 135 where we are supposed to make a new C++ Pawn class in a Blueprint project.

I’m working on MacOS 10.15.5 on Unreal Editor 4.25.3.

When I select Create Class, I get the following error.

Failed to add class 'PawnBase'. Failed to read template file "../../../Engine/Content/Editor/Templates/GameModule.Build.cs.template"

Did it add the files at least?

Hi Dan. It does not add the files. It seems like this is a Mac OS issue because I opened the project on my Windows computer and I was able to do so.

If I make a C++ project in Unreal, I’m able to add new C++ classes. But, this project was started as Blueprints only. If I make a new blueprints only project, then I also have this issue.

Do you have that file? Go to where you have installed Unreal and then follow that path e.g. for me on Windows that would be

C:\Program Files\Epic Games\UE_4.25\Engine\Content\Editor\Template

It should be there and look like this

%COPYRIGHT_LINE%

using UnrealBuildTool;

public class %MODULE_NAME% : ModuleRules
{
	public %MODULE_NAME%(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] { %PUBLIC_DEPENDENCY_MODULE_NAMES% });

		PrivateDependencyModuleNames.AddRange(new string[] { %PRIVATE_DEPENDENCY_MODULE_NAMES% });

		// Uncomment if you are using Slate UI
		// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

This is used when creating the Build.cs file

Turns out the file wasn’t there. Thanks for the guidance.

Here’s what happened. In the first lecture of the Toon Tanks section, it was recommended that we install the UE4Minimal theme. When I did that, I accidentally replaced my Editor and Slate folders with the folders provided with UE4Minimal. I was supposed to “Merge” them instead. I’ve replaced them with my backups and everything works great now.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms