Specify the name of packaged exe?

Hi, there,

is there a way to let me give a name to my game being packaged. thus i could run the WindowsNoEditor/ProjectName/Binaries/Win64/SpecifiedGameName.exe through WindowsNoEditor/SpecifiedGameName.exe.

Thank you!

1 Like

Hello JohnWondle,

To change the actual exe name, you would need to change the name of your project. This can be done by editing the name of the .uproject file. If this is a blueprint only project, it should be as simple as that. If your project includes code however, you will need to go and edit the appropriate parts of the source code to match with the new name. You would then need to regenerate your project files and compile.

Change the name of your target.cs file, or create a new one, an empty child of the other one.

For example if you have SpecifiedGameName.Target.cs, create a new one called MyNewName.Target.cs with this content:

using UnrealBuildTool;
using System.Collections.Generic;

public class MyNewNameTarget : SpecifiedGameNameTarget
{
	public MyNewNameTarget (TargetInfo Target) : base(Target)
	{

	}
}

then change it also in your project settings, or the BuildTarget value in DefaultGame.ini

Now when you package your game you have to use the argument -target=MyNewName

But if you choose to rename SpecifiedGameName.Target.cs to MyNewName.Target.cs instead, the argument -target might not be needed.

5 Likes

Nope, it doesn’t work

Same, doesn’t work for me too.

Doing such a project refactor just to rename the output .exe file seems ridiculously redundant.

Such refactor solution isn’t good even if it works, since it won’t support names with spaces

1 Like

I’ve*1 managed to do this on a cpp project by:

  • renaming the uproject
  • adding a new module with the new name inside the uproject under the modules section
  • add the new module to the modules names on the target.cs
  • rename project.target.cs and projecteditor.target.cs
  • add a folder with a .build.cs for the new module.
  • it’s critical that both the old and new .build.cs have the same dependencies otherwise it will fail weirdly.
  • add a cpp stub module for the new module
  • make the new module export a game module using IMPLEMENT_PRIMARY_GAME_MODULE and made the old module just implement it with IMPLEMENT_MODULE

maybe it was too much (i wonder if creating a new module was necessary or not) but it worked.

*1 with the help of Daekesh on discord. thanks :slight_smile:

1 Like

Thank you so much for your message nande! It worked pretty fine for me.
It was a hell of a headache for me.

And especially thanks to Daekesh by extension!

1 Like

This seemed to work for me (5.3) and didn’t require changing any of the the module names or adding new modules:

  1. Rename the .uproject file to the new name. This change the name of the directory that the game data is stored in. You should not need to edit anything in it.
  2. In your Source folder, rename the two .Target.cs files. Edit the files to make the classes match the file names. These will control the name of the executable. You can still reference your old module names. Those are not user-facing so it should not matter what they are called.
  3. Delete your Binaries/Win64, Intermediate, and Saved folders. Regenerate the project files and rebuild. NOTE: deleting Saved will reset your editor preferences. You may be able to only delete as subset of those, but this is the safest option. I had some errors referencing the old name if I didn’t delete those.

When you rebuild, it should use the new name.

2 Likes

It’s more than a little insane that its this cumbersome to change the name of the .exe that gets built

At least with us we will start an engine project before we have a name chosen … really choosing the name is about the last thing we have any interest in doing and its subject to change really at any time.

ZERO reason the .exe name should be so tightly bound with so much