The following code can import a uasset into your project at runtime. (It was written by midgunner66, see source link below).
But, does this work with any uasset from ANY project? I’m looking for a way to allow my game’s users to import their own uassets into my game, so they can use their own custom armor and clothing. So in my game, the user will click “LOAD YOUR CUSTOM ARMOR”, and they select their uasset made from their own UE project, and it just imports it into my game at runtime. Would that work?
Unfortunately the answer is ‘no’, it wouldn’t work because the assets from another project wouldn’t be “cooked” and embedded into your level files.
[There’s a big difference between the assets you see from the editor, and the actual final cooked assets that are packaged up in distribution formats. Most of the modules needed to even process the data aren’t available (they’re either ‘editor’ or ‘uncooked’ module types.)]
What you want is this:
But I don’t know that there’s been any activity on that in a long time nor if it’s still relevant nor if it’s been superseded by something else. It’s also not trivial. Wish I could help more !
Let’s say that you don’t want to load a full packed world file. These are unlikely to load well outside of the project they were built from. Most Unreal projects/games are built into packed world files, though.
It is possible to arrange loading assets from loose files, rather than merged level files. Let’s assume you already solved that on the source and destination sides.
There are some “hygiene” requirements for assets to work cross-project:
They need to run on the same platform
They need to be compiled with the same engine version
They need to not use any custom classes in the source project that aren’t available in the target project
If you’re trying to build the next metaverse or whatever, then you’re going to have to do a little better than this, though; you’ll probably want to define a backwards compatible file format that you can stay compatible with forever. That file format probably can’t be 100% cooked and optimized for the current engine version; you may need to do some runtime cooking/baking to optimize for the current platform/engine/version. This could be done on the client, or on the server, but it will add additional overhead compared to a “tuned” game. (And now you’ve run into the first of the 8533 reasons why “a metaverse” is actually not at all like a game, and cannot be made to run as well as a game. Everytime someone says “but console game X does Y, why can’t my virtual world with user-constructed buildings and custom avatars do the same?” I just shrug. Some programmers have to stub their own toes a few times before they believe this.)
The problem with Simple UGC Plugin is that it’s complicated to get going, and it looks as if I need to make a modkit. Simple UGC is the most NON-SIMPLE thing I’ve ever seen in the history of simplicity, lol. No offense! ehheh.
Conan Exiles has a modkit, but it’s 270gb.
Ark has a modkit, it’s like 160gb.
The modkit is literally a compiled version of Unreal Engine. That’s a bit overkill. I just want an easy way to allow users to import a custom armor or clothing. Maybe in the future you guys can make it easier for the end user to import Armor, Clothing, and Textures into game at runtime, to make modding easier.
For now, I’m gonna try what jwatte said! Wish me luck.
Yeah, that’s how KSP handled it. There’s internal asset formats for meshes, materials, etc etc and loose files are loaded at runtime and then loaded into procedural meshes it. It was a Unity game though, but the idea’s the same. There’s a skeletal Unity app, mod devs load their assets into the unity editor, then some unity scripts export them all out into loose files containing the ksp-internal formats. The unity editor was useful for its mesh loading, and also for the material editor and previewing materials on meshes, etc. (Even though, the materials were exported into an internal format, then reimported at runtime and converted back into the unity format, the editor was still helpful to mod devs). If you use an fbx loading plugin with some predefined materials etc you could get away without the intermediate… Just load the meshes and textures.