# StaticMesh from soft reference not loading using Asynch Load

**URL:** <https://forums.unrealengine.com/t/staticmesh-from-soft-reference-not-loading-using-asynch-load/2256217>\
**Category:** C++\
**Tags:** c-c, c-class-wizard, c-and-bluepri, c-custommeshcomponen, c-and-blueprint, c-error, c-class, c-custom-shape, c-programming, c-cone-shape, unreal-engine, CPP, question\
**Created:** [January 2, 2025, 6:50pm UTC](https://forums.unrealengine.com/t/staticmesh-from-soft-reference-not-loading-using-asynch-load/2256217 "2025-01-02T18:50:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevDoctor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/devdoctor/32/1013400_2.png) [@DevDoctor](https://forums.unrealengine.com/u/DevDoctor)\
**Post date:** [January 2, 2025, 6:50pm UTC](https://forums.unrealengine.com/t/staticmesh-from-soft-reference-not-loading-using-asynch-load/2256217/1 "2025-01-02T18:50:29Z")

</div>

Hello guys, I am probably slowly becoming insane, I don’t understand why this doesn’t work: I am trying to load stuff (like a mesh) from a soft reference and not a hard one (`TSoftObjectPtr` ). SO I wrote the following code to do that:

```cpp
void APickup::InizializePickup(const TSubclassOf<UItemBase> BaseClass) {
	if(ItemDataTable && !ItemID.IsNone()) {
		const FItemData* ItemData = ItemDataTable->FindRow<FItemData>(ItemID, ItemID.ToString());

		ItemReference = NewObject<UItemBase>(this, BaseClass);
		ItemReference->InizializeItem(ItemData->ItemInventoryData, ItemData->AssetsData, ItemData->InteractableData);

		this->InteractableData = ItemData->InteractableData;

		// TArray<FSoftObjectPath> AssetsToLoad;
		// AssetsToLoad.Add();
		
		AssetsHandle = UAssetManager::GetStreamableManager().RequestAsyncLoad(
			ItemData->AssetsData.ItemMesh.ToSoftObjectPath(),
			FStreamableDelegate::CreateUObject(this, &APickup::SoftActorRefLoaded)
		);
		
		// Set the mesh scale (not sure)
		ItemMesh->SetRelativeScale3D(ItemMesh->GetRelativeScale3D() * ItemData->AssetsData.ItemMeshScale);
	}
}

```

And the following is the code that is executed after the mesh is loaded:

```cpp
void APickup::SoftActorRefLoaded() {
	UE_LOG(LogTemp, Warning, TEXT("THE DELEGATE WAS ■■■■■■■ EXECUTED!"));
	// Set the mesh
	if(IsValid(ItemReference->GetItemAssetsData().ItemMesh.Get())) {
		UE_LOG(LogTemp, Warning, TEXT("THE ASSET WAS ■■■■■■■ LOADED SUCCESSFULLY!"));
	}
	ItemMesh->SetStaticMesh(ItemReference->GetItemAssetsData().ItemMesh.Get());
}

```

Both the logs get executed but the `StaticMesh` is not displayed.  
The mesh is loaded only if I drag the static mesh from the content browser in the scene before running the “game” and I don’t get why. In the `table` where I get the row everything is setup correctly and the reference mesh is saved as a `TSoftObjectPtr<UStaticMesh>` . When the actor is destroyed in the `BeginDestroy()` I cancel the handle `AssetsHandle`:

```cpp
void APickup::BeginDestroy() {
	Super::BeginDestroy();
	// if the handle was not already destroyed, destroy it
	if(AssetsHandle && AssetsHandle->IsActive()) {
		AssetsHandle->CancelHandle();
	}
}

```

---

<div class="post-metadata">

**Author:** ![DevDoctor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/devdoctor/32/1013400_2.png) [@DevDoctor](https://forums.unrealengine.com/u/DevDoctor)\
**Post date:** [January 8, 2025, 3:56pm UTC](https://forums.unrealengine.com/t/staticmesh-from-soft-reference-not-loading-using-asynch-load/2256217/2 "2025-01-08T15:56:44Z")

</div>

Resolved, me big big not intelligent there was no problem in my code, but the mesh I am using is too thin and it clipped under the floor everytime, so I never seen it

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 7, 2025, 3:57pm UTC](https://forums.unrealengine.com/t/staticmesh-from-soft-reference-not-loading-using-asynch-load/2256217/3 "2025-02-07T15:57:02Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
