-
Notifications
You must be signed in to change notification settings - Fork 30
Overwriting Game Resources
KANAjetzt edited this page Mar 23, 2023
·
5 revisions
The overwrites.gd file is used to define resource overwrites in a separate file. In general, any file in a project can be overwritten, but we highly recommend that you only use this feature for images and audio.
We recommend the following directory structure for your overwrites:
res://
└───mods-unpacked
└───Author-ModName
├───mod_main.gd
├───manifest.json
├───overwrites.gd
└───overwrites
└───original_dir_name
└───original_file_name.png
The following steps are required to create an overwrite:
- Open the file you want to replace by right-clicking and selecting Open in File Manager.
- Create a replacement file that matches the metadata of the original file 1:1.
For example, for images, make sure that the resolution is the same. - Add the replacement file to the overwrites directory.
Ideally, structure your overwrites as shown above. - Add the required code to overwrites.gd.
extends Node
func _init():
var overwrite_0 = preload("res://mods-unpacked/Author-ModName/overwrites/assets/images/GodotModded.png")
overwrite_0.take_over_path("res://assets/images/GodotModded.png")
You can use Godot Mod Tool to make overwriting assets easier. If you have the plugin activated:
- right-click -> ModTool: Create Asset Overwrite on the asset you want to replace
Home ~ Setup ~ Mod Structure ~ Mod Files ~ API Methods ~ Logging