This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

Hello! Does anybody know using GDScript to access outside the project folder to open files and other materials that can be used as a secondary addon, aka DLC

I know that there is a way in GDScript that we can use a certain command to access a certain folder in a PC or MAC to get to the external folder that exists outside the game, which maybe it can be useful for installing mods or addons?

It's nothing important or critical but it was a good question with a good example answer that was lost due to the replacement of the old Godot Forums with the new one.

For example let's say my addon folder is located in "C://[USER]/game_location/addons" and I wanted to access the mod folder containing extra TSCN and TRES files necessary to implement the addon...

in Engine by (208 points)
edited by

I can tell you just this (my answer).

On top of that, heard that Godot 3 will improve some things, also change all the way projects work (won't be compatible with 2), maybe making easier multi-package, patch, dlc and mods.

1 Answer

+2 votes
Best answer

Finally figured it out...

Is just:


Where path_to_pack could be res://file_name.pck, user://file_name.pck , maybe external files too.

Resources will be accesible as if these were on the game virtual filesystem (from res://), not sure what happens with files with the same name (I think new files overwrite/override older ones).

Export to a zip first to know the name changes if making binary conversions/compressions/encryption (files are renamed, like scene.tscn.converted.scn)

It may be possible to create/modify a pck file with PCKPacker but not sure.

by (7,954 points)
selected by

Thanks! I'll check it out and see if it works.

P.S. What about loading external PCKs? isn't there a command that allows that to bring in files from outside the executable game file?

It actually works! here is the code:

var data = load("res://Test.tscn.converted.scn").instance()

(NOTE: globalize_path command does allow the godot to load files externally since it quickly uses the "res://" to bring up the location of the computer folder on the OS.

EX: globalize_path("res://") = "C:/[User]/[Username]/Godot/[Project]"

I don't know yet what happens if new resources have autoloads (since engine config is overwritten if packed with the editor), could be interesting if these could be added.

Also, Resource.take_over_path might be useful to rename/overwrite resources after loading them.

Note: As of Godot 3, load_resource_pack function resides in ProjectSettings class

Doc link:

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.