Download

Importing .uasset into a UParticleSystem*

I have a UParticleSystemComponent, and I need to set its Template dynamically.

I can call myParticleSystemComponet->SetTemplate, but SetTemplate needs (class UParticleSystem * NewTemplate) as input.

How to I import my .uasset into the UParticleSystem*???

The only way I’ve seen is using ConstructorHelpers, but I can’t do it in a constructor, because I don’t know which .uasset I’ll be implementing until I’m running.

You can use ObjectFinder if you need to find a specific asset. Depending on how often you want to change the system, it might just be better to create a bunch of UParticleSystem* variables and specify them in the Default Properties of the class/ derived blueprint.

That would probably be faster than trying to find a specific asset each time, and it’s more modular.

Also, this may help -> https://wiki.unrealengine.com/Dynamic_Load_Object

Thanks!

I had already gone with your first proposed solution, to declare a bunch of UParticleSystem* variables. Thanks for the link. I think I might stick with the bunch of variables solution, though.

I was under the impression that ObjectFinder can only be used in a Constructor? Is this true?

Yeah I think that’s true, the code you really want is in that Wiki link I posted. StaticLoadObject I believe.

Stick to the UParticleSystem variables. That wiki article is horribly wrong about everything and using that approach will lead to missing assets in a cooked build.

-Camille