Skip to content

Fix ProjectSettings.load_resource_pack loading to work with Packs and Filesystem #6865

Open
@werdnahull

Description

@werdnahull

Describe the project you are working on

A mobile app with downloadable asset packs

Describe the problem or limitation you are having in your project

On platforms where projects are exported as PCK (iOS, Windows, Linux), ProjectSettings.load_resource_pack works fine and downloaded packs in .zip or .pck load correctly and can be iterated with DirAccess, as well as the project's main res:// folder.

On Android, the project is exported as files into the APK's Assets folder, thereby using Filesystem access instead of Pack access by default. ProjectSettings.load_resource_pack loads Packs, but then changes the default access to Pack access, invalidating any access to the resources on the filesystem.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Allow for ProjectSettings.load_resource_pack to load packs, but not set the default access mode to PCK. This will help Android exports, and likely fix loading and testing Packs from within Editor builds as well.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

bool ok = PackedData::get_singleton()->add_pack(p_pack, p_replace_files, p_offset) == OK;

	if (!ok) {
		return false;
	}

	//STOP MAKING PACKS THE DEFAULT ACCESS TYPE
	DirAccess::make_default<FileSystem>(DirAccess::ACCESS_RESOURCES);
	DirAccess::make_default<AndAlsoDirAccessPack>(DirAccess::ACCESS_RESOURCES);

	using_datapack = true;

	return true;

If this enhancement will not be used often, can it be worked around with a few lines of script?

This is core engine pack loading. Cannot be worked around with script.

Is there a reason why this should be core and not an add-on in the asset library?

This is core engine pack loading. Cannot be worked around with script as an addon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions