Custom c++ ustruct not showing in editor combo box, where blueprint structs do

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

	UPROPERTY(config, EditAnywhere, Category = Niagara, meta = (AllowedClasses = "/Script/CoreUObject.ScriptStruct"))
	TArray<FSoftObjectPath> AdditionalParameterTypes;

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


#pragma once

#include "CoreMinimal.h"
#include "PyromancerNiagaraParams.generated.h"

USTRUCT(BlueprintType)
struct PYROMANCERFIREWORKS_API FPyromancerNiagaraParams
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FLinearColor MainColor;
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FLinearColor SecondaryColor;

		FPyromancerNiagaraParams()
		: MainColor(FLinearColor(0,0,0,0)),
		  SecondaryColor(FLinearColor(0,0,0,0))
	{
	}
};

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.

Thanks for the idea, but, unfortunately, this doesn’t seem to work in this case

What’s the intended usage? How are you planning to use the struct type?

The intended use is to pass it to Niagara as a parameter to avoid setting 200+ parameters per system individually

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:

	ENiagaraTypeRegistryFlags Flags = ENiagaraTypeRegistryFlags::AllowAnyVariable | ENiagaraTypeRegistryFlags::AllowParameter | ENiagaraTypeRegistryFlags::AllowPayload | ENiagaraTypeRegistryFlags::IsUserDefined;
	FNiagaraTypeRegistry::Register(FNiagaraTypeDefinition(FPyromancerNiagaraParams::StaticStruct()), Flags);

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