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

DFined
Fri, 07 Jun 2024 20:52:58 +0000
Programming & Scripting

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))
	{
	}
};

7 posts - 4 participants