Add Asset from Plugin

I am currently working on a plugin that needs to create actors based on OSG scene descriptions and place them into the editor (no runtime spawning). For that purpose, I have created an Actor that parses a given JSON document and composes the scene within itself.

A JSON node could look something like this:

    "Name" : "Monkey",
    "Type" : "Mesh",
    "Position" : [0.0,0.0,0.0],
    "Rotation" : [0.0,0.0,0.0],
    "Scale" : [0.0,0.0,0.0],
    "ResourcePath" : "C:/MyModels/Monkey.fbx",
    "Children" : []

Obviously, Unreal needs an existing uasset to create StaticMeshComponents. So previously, I have just chosen a value for “ResourcePath”, which would point to an existing asset in my project. Since I am dynamically parsing these descriptions though, I would like to be able to import new assets from within my plugin.

Is there a way to use the import action of the Content Browser, or some similar functionality that would help me do this?

Any help would be appreciated!!

No one? The slightest hint would be useful.

I’m running on the same problem, did you find a solution?

As one might assume, Unreal engine isn’t really built to load assets at runtime. Multiple aspects of the engine rely heavily on precomputing stuff before switching from editing to game mode. IMHO there is no simple way to dynamically import new resource files (especially models) at runtime. I ended up trying to write a custom import feature to read model files and use a ProceduralMeshComponent to display them. It sort of worked, but concerns towards robustness, etc, lead me to stop following up on it further. I didn’t have the time for such a low level “hacky” implementation. Just found this plugin, which defines a RuntimeMeshComponent. Seems to do something similar and looks promising. That said, I haven’t tried it.