How to create Properties depending on Settings

Hi there!

I made custom K2Nodes for a Dialogue System and I would like those nodes to have a set of customizable properties, defined by the user in the plugin’s settings.

For example, I would like users to be able to go into the Plugin’s Settings (in their Project Settings), to add a list of parameters with a Name, a ToolTip, a Class and a Default Value. They could want to add:

  • Character - The character talking - Text - “Narrator”
  • Voice - The voice sound to play - Dialogue Voice - Null
  • etc.

Then, in the Details Panel of the Dialogue nodes they will use in their Blueprints, I would like these properties to show up with editable values for each node.

In some sense, it would look a lot like Blueprint’s variable creation where you add a variable, select its type and name, etc.
Is that something possible?

Thank you in advance,
Bye!

CraftyWeazel

I think it mostly depends n how you store those properties in dialog node… or you didn’t thought out about this yet?

You might consider incorporating registering custom UStruct or even incorporate existing blueprint structure asset to set those parameters. And then you can direct that struct directly to property editor (if it possible, but it defiantly should open up more options).UStruct will also help you to set up storage for those parameters.

You can also write down custom UI for some medium struct type

Thanks for the quick reply!

I’m not restricted on storage methods, I can do whatever is better to achieve what I described. In fact, the custom UStruct solution seems great.

How do I make my custom Struct storage editable by the user in the settings?

I would like him/her to create new fields, give them names, etc.

Look up Blueprint structure asset as it generates custom ustruct. You might as well just bind blueprint structure asset, with that your users would able to reuse the type in blueprints outside of your plugin

Ironocly, it’s stupidly easy on C++ side as user would just make struct and do metadata entry USTRUCT() or use some common base struct, then find UStruct object with it. You might consider that as a extra feature to make your plugin C++ usable.

Or just make UStruct selectable, so both blueprint and C++ structs can be picked

Alright, that’s a great idea, thanks!

Then, in my K2Node, how will I tell which kind of struct I need, actually?
If I write

UPROPERTY(EditAnywhere)
FCustomStruct CustomData;

Then, how do I change FCustomStruct to be the type the user chose in the settings? TSubclassOf won’t work with Structs, and even if it did, it would only be a class specifier, not an instance.