2
\$\begingroup\$

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)?

\$\endgroup\$
  • \$\begingroup\$ Please use edits to add substantial new information or clarifications to your post, not just to shuffle content around to bump the question in the feed. \$\endgroup\$ – DMGregory Jul 23 '20 at 10:28
0
\$\begingroup\$

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...

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.