TransWikia.com

How to support importing .uasset files in game for content creators(UE4)?

Game Development Asked on November 2, 2021

I would like to support importing clothes(as SkeletalMeshes) and props(as StaticMeshes) as uasset files into game for content creators, which obviously have not been packaged with the game.
Basically I am looking for a clean modding pipeline.

EDIT:
TLDR:
Is it possible to load .uasset files with StaticLoadObject() into game and use assets from it after the game has been packaged?
Or does it only work with packaged files?

If not what function do you recommend for that purpose?

not-TLDR

Bringing in stuff does work well in the editor, using Rama’s LoadObjectFromAssetPath, just by:

  1. right clicking my asset in Content Browser

  2. copy reference

  3. and copy pasting the result to the path variable of the LoadObjectFromAssetPath blueprint node.

Well, I am not sure if it is going to work at runtime…

So I used my favourite search engine and put in some keywords and bumped into this.

Then I wrote some code(Blueprint Function Library):

void UFileDialogOpener::LoadFile(FString  from) {

    auto result = StaticLoadObject(UStaticMesh::StaticClass(), NULL, *from);

    GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Red, "from: " + from);

    if(result)GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Green, "name: " + result->GetName());
    else GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Green, "no result");

    auto * meSkelMesh = Cast<UStaticMesh>(result);

    
    if(meSkelMesh)GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Red, meSkelMesh->GetName());
    else GEngine->AddOnScreenDebugMessage(-1, 150.0f, FColor::Red, "no mesh");

}

As per the debug messages StaticLoadObject does not find anything.
I tried feeding it the both of the results of righclicking my asset in Content Browser and choosing either: copy reference and copy path.
Neither of them yielded any result.

Not sure where I am messing up.

Anyways, just wondering if anyone can recommend a better way of doing this(code, plugins etc)?

One Answer

After doing some research and stuff I figured out, my best bet is using Unreal's UGC solution. I think that would take care most of the heavy lifting for us, and for the content creators as well. Besides I would appreciate any help on the above code and questions, just to understand why it does not work...

Answered by formatc2013 on November 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP