Download

Using the Object libraries / Load Object library created in content Folder in C++ / UObject stuff

Hello community! I really need help. I have been figuring this out hours after hours and got absolutely nowhere. I simply want to load a material inside C++ to use in my Actor! How hard could it be… It seems it can be extremely hard, atleast for me! I have been looking Unreal Engine page: Asynchronous Asset Loading | Unreal Engine Documentation but i cannot make perfect sense for it. I know generally what this mean, but there is nothing about what actually is that Objectlibrary where all these thing starts. There isn’t anything about what type is that BaseClass. I just dont know what they are.

If i call function LoadAssetDataFromPath, my editor cannot find the said function(i tried to use UObject as BaseClass). Finally there isn’t much info about what these lines do:


const FString* FoundTypeNameString = AssetData.TagsAndValues.Find(GET_MEMBER_NAME_CHECKED(UAssetObject,TypeName));
 if (FoundTypeNameString && FoundTypeNameString->Contains(TEXT("FooType")))

Sorry if i sound like ******, but i am so frustrated. I really miss the Documentations the Unity has, where there is working example from top to bottom for each function and system the editor has.

But that’s that :). Now in the matter in hand. I figured out, that it would be cool to load the Object library created in Editor and just get all the data inside it in C++ and use that. I have tried million things, but nothing ever loads out. Has somebody done this? Could somebody give working example about Object Library, with stuff commented in it? I’d really love to learn how to use em.

Also, if i have an something as type of UObject. Can i just use casting like MyMaterial = Cast(SomeUObjectType) ? Or how do i convert the UObject to the type i want?

Here is the picture of my ObjectLibrary created in Editor.
27579bbf29285346ba5a381aa85b3581fab724bc.jpeg

Finally: If i use


MaterialToUse = LoadObject<UMaterial>(this, TEXT("/Game/Numbers/Materials/1_Mat.1_Mat"), NULL, LOAD_None, NULL);

Does this work in a Cooked Build also? LoadObject is simple, but i’d love to learn to use the ObjectLibrary also.