Mounting pak files at runtime
Hi guys, Im using this plug in to mount pak file at runtime - https://github.com/moritz-wundke/AsyncPackageStreamer
The plugin compiles with no issues and can be used on UE4.7.2, what I'm trying to do is stream a local pak file, this is my code:
but the engine crashes due to a null pointer exception on this class FPakPlatformFile::FindAllPakFiles, Im not sure if I'm using the plug in correctly or not, does anybody have used such plug in before ??
thanks in advance.
i have found the solution of crash problem. a variable was wrongly initiaintialized. because of wrong value LowLevelFile value assignment operation always was skipped . thats why it was always null and always was crashing. now i have to check if pak file successfully get mounted. if it works now then i will post the fix until then dont waste your time to make the plugin work. it will always crash.
did anybody have any success?
answered Apr 17 '16 at 02:28 AM
Pak file generation :
Cooked vs un-Cooked content
cooking means you need process your assets and optimize them for your target platform, uncooked assets are not optimized and intended to work only for development under UE4 editor.
if you are working on a development build you create the pak files using *.uasset files from the editor using unrealPak.exe as follows:
On the other hand if you want to use pak files on stand alone builds you need to cook the contents for your target platform for example Windows / Linux / iOS / PS, etc. Cooked folder is normally found at: \Cooked\WindowsNoEditor\YourProjectName\Content\Assets\
if the folder is empty or does not exists is because you havent "cooked" the contents for the target platform, and you can do it within the editor, just go to File menu and click "Cook contents for [Target Platform]"
NOTE: To avoid confussions you should name you pak files according to the target:
• If the list is generated from editor.uassets, then the pak file should end with _Editor.pak
• If the list is generated from cooked file assets, then the pak file should end with _Standalone.pak.
Editor or "uncooked" content wont work with Stand Alone / Distribution / Shipping builds
Using the plugIn
1) Create a folder called "Plugins" at the root level of your game
2) Copy the contents of AsyncPackageStreamer into it, the file structure should look like this: • YourGame\Plugins\AsyncPackageStreamer
3) Verify if it's correctly installed by opening UE4 Editor go to Window Menu --> PlugIns --> Project (Async Package Streamer should be listed there) also when opening the editor for the first time it should start compiling the plugIn
4) Add a reference to YourProjectName.Build.cs (located at the root level of the solution) to include the plugin Headers into the compilation process:
5) Create a class somewhere a Test widget will be enough for testing and include the AsyncPakage streamer header file:
6) Implement IAssetStreamer methods
hugomj_ca and mfish, we appreciate your time and effort to answer all these amateur questions. But most of us having no luck. for reference, Can u guys post a proper pak file which is working fine on your side? Using that pak we at least we can figure out where the problems lies on our side. On cooking process or in Code.
The way I solved this problem, assuming the pak file was setup correctly, was to load a local pak file with the following code:
Where PakPath is an FString that points to the location of your pak file. Once you load in the pak file you can access the maps and other assets from within the pak file the same way you would if they had been packaged with your game.
answered Jul 30 '15 at 07:35 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here