+1 vote

In Unity you can create a directory called StreamingAssets. When exporting it will just copy-paste this directory, without packaging/serializing it, allowing XML-files to remain readable and editable in the exported game. I wish to do the same thing in Godot, but have been unable to find an option to do so.

So my question is: is it possible to create the same functionality of Unity's StreamingAssets in Godot?

SOLUTION: Unfortunately I haven't found a way to do this using Godot. However I did find a way to emulate it using a batch file.

For reference, I have my bat-file located on D:\Godot_v3.1-stable_mono_win64\Projects\Wargame, my game project is in D:\Godot_v3.1-stable_mono_win64\Projects\Wargame\Wargame.

This is the content of my bat-file:

set mypath=%~dp0
set godot=D:\\Godot_v3.1-stable_mono_win64\\Godot_v3.1-stable_mono_win64.exe
set exportsDir=D:\\Godot_v3.1-stable_mono_win64\\Projects\\Wargame\\Exports
set windowsDir=%exportsDir%\\Windows
set linuxDir=%exportsDir%\\Linux

cd Wargame
%godot% --export "Windows Desktop"  %windowsDir%\\Wargame.exe
%godot% --export "Linux/X11"  %linuxDir%\\Wargame.exe

rmdir /Q /S %windowsDir%\\StreamingAssets
rmdir /Q /S %linuxDir%\\StreamingAssets

xcopy StreamingAssets %windowsDir%\\StreamingAssets /I /Y /E /H
xcopy StreamingAssets %linuxDir%\\StreamingAssets /I /Y /E /H

cd %mypath%
in Engine by (13 points)
edited by

1 Answer

+1 vote

Just exclude the XML files during export in the export settings and then include the XML files in the directory of your exported project.

Also, if those files are for saving the game state, take a look at this: https://www.google.com/url?q=https://docs.godotengine.org/en/3.1/classes/class_configfile.html&sa=U&ved=2ahUKEwjV4MXLgd_hAhUDmlkKHT6zAbwQFjAAegQIBBAB&usg=AOvVaw1YQDRjb3F3iagDg1e4yrwN

EDIT: In the export settings you can also choose to include .XML files even though they aren't resources.


by (132 points)
edited by

Thank you very much. Is there a way to automate the inclusion of the XML files in the exported project?

Also the XML files are not for saving game states, but thanks for the extra tip regardless.

Just tried it and the XML files are nowhere to be seen. When exporting non-resources, do they not get packaged into the exe (or pck)? I want them to remain editable by the players after exporting and the file structure of the "StreamingAssets" directory to remain as-is.

Also some screenshots in case I misunderstood something.

Problem is, the files are packaged in the .pck file, making them inaccessible. I don't know a good workaround.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.