# Mounting .pak file screws up asset loading in Windows

**URL:** <https://forums.unrealengine.com/t/mounting-pak-file-screws-up-asset-loading-in-windows/403451>\
**Category:** C++\
**Tags:** pak, unreal-engine, CPP, question\
**Created:** [September 1, 2017, 6:49am UTC](https://forums.unrealengine.com/t/mounting-pak-file-screws-up-asset-loading-in-windows/403451 "2017-09-01T06:49:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nullbus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nullbus](https://forums.unrealengine.com/u/nullbus)\
**Post date:** [September 1, 2017, 6:49am UTC](https://forums.unrealengine.com/t/mounting-pak-file-screws-up-asset-loading-in-windows/403451/1 "2017-09-01T06:49:35Z")

</div>

Hello, I have strange behavior on 4.17

I made some .pak files using UnrealPak and mounted it in runtime. It compiled and worked as expected in Android. But in windows, engine cannot find most of assets after mounting pak even asset file was not inside in the pak file.

I used code like this:

```
void UMyGameInstance::Init()
{
	Super::Init();

	auto PakPlatformFile = static_cast<FPakPlatformFile*>(FPlatformFileManager::Get().FindPlatformFile(TEXT("PakFile")));
	if (PakPlatformFile == nullptr)
	{
		PakPlatformFile = static_cast<FPakPlatformFile*>(FPlatformFileManager::Get().GetPlatformFile(TEXT("PakFile")));
		if (PakPlatformFile->Initialize(&FPlatformFileManager::Get().GetPlatformFile(), TEXT("")))
		{
			UE_LOG(LogTemp, Log, TEXT("created new FPakPlatformFile"));
			FPlatformFileManager::Get().SetPlatformFile(*PakPlatformFile);
		}
		else
		{
			UE_LOG(LogTemp, Error, TEXT("cannot initialize patch file!"));
		}
	}

	check(PakPlatformFile);

	FString path = FPaths::GameSavedDir() / TEXT("Characters.pak");
	bool ret = PakPlatformFile->Mount(*path, 200);
	check(ret);
}

```

As a note, just resetting platform file is not cause the problem. When **after pak file mounted explicitly** , the problem arises.

And I tried replacing `PakPlatformFile->Mount()` to `FCoreDelegates::OnMountPak.Execute()`, but no luck. Is it a bug? Or I might done a mistake?

---

<div class="post-metadata">

**Author:** ![nullbus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nullbus](https://forums.unrealengine.com/u/nullbus)\
**Post date:** [September 4, 2017, 2:49am UTC](https://forums.unrealengine.com/t/mounting-pak-file-screws-up-asset-loading-in-windows/403451/2 "2017-09-04T02:49:19Z")

</div>

[https://github.com/EpicGames/UnrealEngine/pull/3548](https://github.com/EpicGames/UnrealEngine/pull/3548)

I noticed there is some fixing is on going. Looking forward to the issue being solved ☹

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1af62794](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1af62794](https://forums.unrealengine.com/u/anonymous_user_1af62794)\
**Post date:** [May 14, 2019, 7:51am UTC](https://forums.unrealengine.com/t/mounting-pak-file-screws-up-asset-loading-in-windows/403451/3 "2019-05-14T07:51:35Z")

</div>

In case the default platform file mana=get is not PakFile, you need to restore it once you are done mounting the pak. This is what my custom UndoSetPakPlatformFile does.

1. SetPakPlatformFile

2. mount and do stuff …

3. UndoSetPakPlatformFile

4. Everything should be fine now.

---

<div class="post-metadata">

**Author:** ![alirizvi7861](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alirizvi7861](https://forums.unrealengine.com/u/alirizvi7861)\
**Post date:** [February 3, 2024, 4:50pm UTC](https://forums.unrealengine.com/t/mounting-pak-file-screws-up-asset-loading-in-windows/403451/4 "2024-02-03T16:50:28Z")

</div>

can you please explain how to generate pak files for android and utilize them, have successfully generated and utilized for windows but don’t know how to do this for android mobile
