Hi! I’ve been trying to use a custom structure in Niagara. I’ve found that I need to add the structure in the plugin config for Niagara. When I create a struct in the blueprint editor, I can just add it and it basically works. If I create a ustruct in c++, it doesn’t show up in the dropdown combo box at all. I tried a workaround, creating a structure in BP and adding my c++ structure to it as a field. This worked fine, until I added the BP structure to the Niagara types. Not only does this not work in Niagara, it breaks the BP struct asset - it starts showing the inner c++ structure as mising until I delete the Niagara config. I looked for the relevant setting in code and found this
I assume the relevant part is the ScriptStruct type, but I can’t figure out how and what to do with my UStruct to expose it to that filter or why the blueprint struct is visible to it by default
I’ll try to dig around in the source some more but currently have no clue and would much appreciate any help
For reference, here is my basic struct I am trying this with
I never worked with Niagara and after some time looking at it, I didn’t find how to create similar code and test the solution. But from experience in creating SceneComponents I can suggest you try USTRUCT(BlueprintType, meta = (BlueprintSpawnableComponent, IsBlueprintBase="true")).
Sry, if that didn’t help…
BlueprintSpawnableComponent allows the instantiating of classes/structs in blueprints. IsBlueprintBase="true" (for structs) and Blueprintable (for classes, and isn’t a meta but the same parameter as BlueprintType) for creating derived objects by blueprints.
Ok, so, I’ve mostly figured it out. I still don’t really know why its like this, but the reason the c++ structs aren’t available there is because, at least in this specific place they aren’t supposed to be. For c++ structs the apparently correct way to add them as Niagara types is doing this during module startup: