Is this the best way to instantiate a BP on the fly?

HI all… I have tried to find other ways of doing this but coming up short.
I have a blueprint that inherits from a C++ class. Th C++ class is purely a logic class, meaning no meshes, no other actors etc. 99% just C++ code to chew on data.

I have a widget blueprint, and inside that widget, I want to instantiate an instance of the BP class… Is using the Spawn Actor the only way to do this? Or is there a better approach to creating a BP on the fly??

Thanks all!

Yeah- there’s no better way to spawn an actor, unfortunately.

From how you talk about the class, it seems like you’re not actually storing any data in the CPP class. If that’s the case, you can make the functions you need static. That way you don’t need to instantiate the class at all.
Blueprint can’t handle static variables, but it can handle static functions perfectly fine.

Alternatively, you can make that class an object instead of an actor. Objects have less overhead, but they can’t be used in every situation since they can’t have components or a transform.

depending on how many of these can be allowed to exist. if this could be a Singleton then it could become a Subsystem, and then it would just exist whenever the thing it is a subsystem of exists.
for example if this was a UWorldSubsystem then it would just exist and be accessible in any context that UWorld exists and is accessible
you can look here for more details on your options

if this doesn’t hold anything but just has functions that can be called to do work then it could just be a UBlueprintFunctionLibrary which is just a container for static functions that can even be called/invoked in blueprint (don’t even need to grab an instance in that regard)