Create a *.Target.cs with name that starts with number

As with many Unreal projects, it’s likely the name of the game isn’t known when the project is created. There’s some [handy [Content removed] that explains how to rename a project, but it relies on changing the name of the *.Target.cs file. Since C# doesn’t allow class names that begin with a number, how can a game change its executable name to something that begins with a number in the correct Unreal way?

Hey there Nathan,

Unfortunately there is a relatively terse requirement here because of how we compile the Target rules (there’s an implicit mapping between the filename and the class that we instantiate reflectively).

`// Currently, we expect the user’s rules object type name to be the same as the module name + ‘Target’
string TargetTypeName = TargetName + “Target”;

// The build module must define a type named ‘Target’ that derives from our ‘TargetRules’ type.
TargetRules? TargetRules = CreateTargetRulesInstance(TargetTypeName, new TargetInfo(TargetName, Platform, Configuration, Architectures, ProjectFile, Arguments, IntermediateEnvironment), Logger, IsTestTarget, ValidationOptions);`Reference code here.

I don’t see any such instances internally where we start a Target class name with a number (certainly because of the C# limitation you’re speaking to). You could simply prefix with an ‘_’ to avoid this problem.

Kind regards,

Julian