String to Class?

Edit: after messing around with this for a while, I’ve come to realize it’s the same issue as using ‘GetClass’ from an asset loaded from the asset manager. It returns an object class but I want an actor class and I can’t figure out how to convert them.

After poking around for a while in the asset manager, I found a way to do this in 4.26. Not sure when all the required nodes were added to the engine.

The two critical nodes are ToSoftClassReference (SoftClassPath) (in the category Utilities) and AsyncLoadClassAsset.

Right click the blue SoftClassPath structure node and split it; it becomes a single string. The string to build for the soft path is formed this way:

/Game/[subfolderA]/[subfolderB]/[subfolderX]/[ASSET].[ASSET]_C

where [ASSET] is the display name of the class you want to reference dynamically. You can see a sample of this by hovering an asset in the content browser and looking at the path for its parent class.

The async load class returns an object class, so if you want to spawn an actor from that, you can (hopefully) use one of the workarounds mentioned here.

2 Likes