# Confusion as to how to asyncroniously load a class, then spawn it.

**URL:** <https://forums.unrealengine.com/t/confusion-as-to-how-to-asyncroniously-load-a-class-then-spawn-it/2110027>\
**Category:** Programming & Scripting\
**Tags:** data-asset, asynchronous-asset-l, async, unreal-engine, question\
**Created:** [November 7, 2024, 6:07pm UTC](https://forums.unrealengine.com/t/confusion-as-to-how-to-asyncroniously-load-a-class-then-spawn-it/2110027 "2024-11-07T18:07:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmancoder](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jmancoder/32/943721_2.png) [@jmancoder](https://forums.unrealengine.com/u/jmancoder)\
**Post date:** [November 7, 2024, 6:07pm UTC](https://forums.unrealengine.com/t/confusion-as-to-how-to-asyncroniously-load-a-class-then-spawn-it/2110027/1 "2024-11-07T18:07:07Z")

</div>

I’m trying to make it so you can click a button in a widget to spawn different actors. Curently, I’m storing a data asset variable in each button widget with a soft reference to the Blueprint class I want to spawn, along with its name and icon.

The problem is, async loading that soft reference doesn’t actually give me the correct class unless I cast to it, which would defeat the purpose. Obviously I don’t want to make hard references to every BP class I could possibly spawn (including their accompanying meshes, textures, etc.), but I don’t understand how else to get the correct class to spawn. Can this only be done in C++ or something?

---

<div class="post-metadata">

**Author:** ![jmancoder](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jmancoder/32/943721_2.png) [@jmancoder](https://forums.unrealengine.com/u/jmancoder)\
**Post date:** [November 7, 2024, 7:37pm UTC](https://forums.unrealengine.com/t/confusion-as-to-how-to-asyncroniously-load-a-class-then-spawn-it/2110027/2 "2024-11-07T19:37:10Z")

</div>

Ok, nevermind. All I had to do was cast it from the Object class to the Actor class after async loading the soft class ptr, and it spawned just fine lol.

---

<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:** [December 7, 2024, 7:37pm UTC](https://forums.unrealengine.com/t/confusion-as-to-how-to-asyncroniously-load-a-class-then-spawn-it/2110027/3 "2024-12-07T19:37:56Z")

</div>

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