Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Manually changing application icon for Windows
Windows applications use a Windows only format called ICO for their file icon and taskbar icon. Since Godot 4.1, Godot can create an ICO file for you based on the icon file defined in the Windows export preset. Supported formats are PNG, WebP, and SVG. If no icon is defined in the Windows export preset, the application/config/icon project setting is used automatically instead.
This means you no longer need to follow the steps in this section to manually create an ICO file, unless you wish to have control over the icon design depending on its displayed size.
创建自定义 ICO 文件
You can create your application icon in any program but you will have to convert it to an ICO file using a program such as GIMP.
这个视频教程展示了怎么用 GIMP 导出 ICO 文件。
也可以使用这个 ImageMagick 命令,将 PNG 图像转换为 hiDPI 友好的 ICO 文件:
magick convert icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico
根据你所安装的 ImageMagick 的版本的不同,你可能会需要把 magick
去掉,运行以下命令:
convert icon.png -define icon:auto-resize=256,128,64,48,32,16 icon.ico
警告
为了使 ICO 文件有效地替换默认 Godot 图标,它必须包含默认 Godot 图标所包含的所有尺寸:16×16、32×32、48×48、64×64、128×128、256×256。如果该 ICO 文件未包含所有尺寸,没有被覆盖的尺寸将保留默认 Godot 图标。
上面的 ImageMagick 命令考虑到了这一点。
更改任务栏图标
任务栏图标是项目运行时显示在任务栏上的图标。

To change the taskbar icon, go to
Project > Project Settings > Application > Config, make sure
Advanced Settings are enabled to see the setting, then go to
Windows Native Icon
. Click on the folder icon and select your ICO file.

这个设置只会修改 Windows 导出的游戏图标。设置 macOS 的图标请使用 Macos Native Icon
(macOS 原生图标)。其他平台请使用 Icon
(图标)设置。
更改文件图标
文件图标是你单击以启动游戏的可执行文件的图标。

To do that, you will need to specify the icon when exporting. Go to Project > Export. Assuming you have already created a Windows Desktop preset, select your icon in ICO format in the Application > Icon field.

测试结果
你现在可以导出项目了。如果一切正常,你应该看到:

备注
If your icon isn't showing up properly try clearing the icon
cache. To do so, open the Run dialog and enter ie4uinit.exe
-ClearIconCache
or ie4uinit.exe -show
.