# Asset not found in AssetRegistry until I open it in editor

**URL:** <https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [January 15, 2015, 9:56am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034 "2015-01-15T09:56:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_2db7ca80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2db7ca80](https://forums.unrealengine.com/u/anonymous_user_2db7ca80)\
**Post date:** [January 15, 2015, 9:56am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034/1 "2015-01-15T09:56:01Z")

</div>

I am using the following code to find a particular asset in a test I am writing:

```
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
IAssetRegistry& AssetRegistry = AssetRegistryModule.Get();
FAssetData CalmSeaOceanMaterialAsset = AssetRegistry.GetAssetByObjectPath(FName(TEXT("Material'/Game/Materials/Ocean/OceanDisplacementMaterials/SmallWaves.SmallWaves'")));

```

When I run this straight after starting the editor, `CalmSeaOceanMaterialAsset` contains an invalid reference. However, if I open the SmallWaves asset and then run this, it works as expected. Is this a bug/is there something I can do to force the object to be loaded before I try to find it in the AssetRegistry.

I am using UE4.4.1

I propose a tag “asset-registry” but don’t have high enough rep to create it.

---

<div class="post-metadata">

**Author:** ![Br\_P\_d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/br_p_d/32/918657_2.png) [@Br\_P\_d](https://forums.unrealengine.com/u/Br_P_d)\
**Post date:** [January 15, 2015, 10:42am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034/2 "2015-01-15T10:42:22Z")

</div>

Hi there! In the editor you might have to wait until the asset registry has finished discovering assets.

If `AssetRegistry.IsLoadingAssets()` returns true, you might have to come back later. Alternatively, you can bind onto its `OnFilesLoaded()` event to get notified when it has finished loading files.

EDIT:  
This turned out to be failing due to the _Material’’_ type decoration that only succeeds when the asset is loaded. Passing in just the object path proved successful in both cases.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2db7ca80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2db7ca80](https://forums.unrealengine.com/u/anonymous_user_2db7ca80)\
**Post date:** [January 15, 2015, 11:23am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034/3 "2015-01-15T11:23:26Z")

</div>

Thanks, unfortunately `AssetRegistry.IsLoadingAssets()` returns false but the asset is still not found.

---

<div class="post-metadata">

**Author:** ![Br\_P\_d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/br_p_d/32/918657_2.png) [@Br\_P\_d](https://forums.unrealengine.com/u/Br_P_d)\
**Post date:** [January 15, 2015, 11:28am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034/4 "2015-01-15T11:28:39Z")

</div>

Could you try changing it to just “/Game/Materials/Ocean/OceanDisplacementMaterials/SmallWaves.SmallWaves” without the extra UObject type decoration? When it is loaded, it will route through FindObject\<\> but when it has not been loaded yet, it needs to exactly match the object path that is stored in the asset registry map.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2db7ca80](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2db7ca80](https://forums.unrealengine.com/u/anonymous_user_2db7ca80)\
**Post date:** [January 15, 2015, 11:46am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034/5 "2015-01-15T11:46:19Z")

</div>

Thank you, this has fixed it if you want to update your answer to include the correct information 🙂 Is this documented somewhere I’ve missed?

---

<div class="post-metadata">

**Author:** ![Br\_P\_d](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/br_p_d/32/918657_2.png) [@Br\_P\_d](https://forums.unrealengine.com/u/Br_P_d)\
**Post date:** [January 15, 2015, 11:51am UTC](https://forums.unrealengine.com/t/asset-not-found-in-assetregistry-until-i-open-it-in-editor/304034/6 "2015-01-15T11:51:07Z")

</div>

Thanks, I updated the answer.  
There’s some information [here](https://docs.unrealengine.com/latest/INT/Programming/Assets/Registry/index.html), but it doesn’t document the ObjectPath syntax explicitly. I’ll look to get this updated.
