# How to use UKismetSystemLibrary::LoadAsset

**URL:** <https://forums.unrealengine.com/t/how-to-use-ukismetsystemlibrary-loadasset/898322>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [April 12, 2023, 8:54pm UTC](https://forums.unrealengine.com/t/how-to-use-ukismetsystemlibrary-loadasset/898322 "2023-04-12T20:54:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexanderSt](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexanderst/32/465118_2.png) [@AlexanderSt](https://forums.unrealengine.com/u/AlexanderSt)\
**Post date:** [April 12, 2023, 8:54pm UTC](https://forums.unrealengine.com/t/how-to-use-ukismetsystemlibrary-loadasset/898322/1 "2023-04-12T20:54:02Z")

</div>

I’m new to the Unreal Engine’s C++ and have some problem.  
I don’t know how to use this function: UKismetSystemLibrary::LoadAsset();  
I don’t underestand it. Here is function arguments that are required:

```auto
void UKismetSystemLibrary::LoadAsset(const UObject* WorldContextObject, TSoftObjectPtr<UObject> Asset, UKismetSystemLibrary::FOnAssetLoaded OnLoaded, FLatentActionInfo LatentInfo)

```

And i don’t underestand how to use LatentInfo and OnLoaded callback.  
And i don’t underestand how OnLoaded callback should look like, what arguments it can take. How do i should know it? From function’s sources?  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/6/8c6bd445b90acd4431b49829ca0fdb02fee0c982.png)  
if so then LoadedCallback should be like this:

```auto
UKismetSystemLibrary::FOnAssetLoaded OnLoadedCallback(UObject* LoadedObject);

```

But … how do i return this type? `UKismetSystemLibrary::FOnAssetLoaded `.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/f/f8f7fc5938ad459733e4f133f4114bc6795f00ff.png)

And it dosen’t want to accept it. Because “No suitable constructor exists …”

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/4/8/d48ce799363b3757fef3d07f21cb7c0761feef05.png)

And in google no code examples that will help to work with this function.  
It looks like this async asset loading stuff done by everyone in blueprints, not in c++.  
I can do it on blueprints as well, it’s not the case.  
Because case is - what if i met some async functions again in future. How do i should handle them?  
And also - i know that c++ supports lambdas. Can they be used here?  
Thanks.

---

<div class="post-metadata">

**Author:** ![ScrewdriverHyena](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/screwdriverhyena/32/679006_2.png) [@ScrewdriverHyena](https://forums.unrealengine.com/u/ScrewdriverHyena)\
**Post date:** [April 13, 2023, 1:34am UTC](https://forums.unrealengine.com/t/how-to-use-ukismetsystemlibrary-loadasset/898322/2 "2023-04-13T01:34:52Z")

</div>

.h

```auto
UCLASS()
class MYGAME_API UMyClass : public UObject
{
    GENERATED_BODY()

    public:

    UKismetSystemLibrary::FOnAssetLoaded OnAssetLoaded;

    void OnAssetLoadedCallback(UObject* Loaded);

```

.cpp

```auto
OnAssetLoaded.BindDynamic(this, &UMyClass::OnAssetLoadedCallback);
LoadAsset(GetWorld(), Asset, OnAssetLoaded, FLatentActionInfo());

```

This should work, let me know.

---

<div class="post-metadata">

**Author:** ![AlexanderSt](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexanderst/32/465118_2.png) [@AlexanderSt](https://forums.unrealengine.com/u/AlexanderSt)\
**Post date:** [April 13, 2023, 12:59pm UTC](https://forums.unrealengine.com/t/how-to-use-ukismetsystemlibrary-loadasset/898322/3 "2023-04-13T12:59:14Z")

</div>

yes it works, Thanks)
