Loading blueprints from c++ on Android


I am trying to load a blueprint from c++. I can do it successfully running from the editor. But when running on Android, it cannot find the blueprint… I get the error…
LogUObjectGlobals:Warning: Failed to find object ‘Blueprint /Game/Terrain/TerrainManagerBP.TerrainManagerBP’

My blueprint is not referenced in the editor. I am loading it dynamically like this…
Cast(StaticLoadObject(ObjClass::StaticClass(), NULL, TEXT(“t /Game/Terrain/TerrainManagerBP.TerrainManagerBP”);

Again, this works fine when running from the editor, but Android can’t find the blueprint.
I’ve tried many variations. In my research, it seems that I need to create a reference to the blueprint somewhere?

Please help!

Blueprint assets are editor-only, they do not exist in a packaged game. What does exist is the class generated by the blueprint, which is presumably what you want access to anyway?

Try the following:

UClass* BPClass = LoadObject< UClass >(nullptr, TEXT("/Game/Terrain/TerrainManagerBP.TerrainManagerBP_C"));

Note the ‘_C’ at the end, which identifies the generated class as opposed to the blueprint itself.

Ah thank you. This is exactly what I was looking for! It seems to work this way.

If your blueprint have parents blueprint , LoadObject will not load inherited components that registered in parents blueprint.
you need to use SpawnActor() for blueprint that have parent blueprint.

The two are completely unrelated. The above loads a Blueprint class into memory. SpawnActor instantiates an object of some (already loaded) class into a world.