#Inline values for custom type in unit node – is it possible?

1 messages · Page 1 of 1 (latest)

sleek mica
#

Hello everyone,

I'm reaching out for your help.

I'm trying to find a way to add inline values (directly in the node) for my custom type in a unit node, but I haven’t found a proper solution.

For example, with MyClass, I can see that Name and Amount are available in the blackboard, but not directly in the node itself.

What I’m looking for is something like the "Set Font" node in TextMesh Pro, where you can assign values directly inside the node. Is this possible?

I’ve also tried using a ScriptableObject, but I can’t reference it inline in the node either. Is this simply not possible?
I’ve updated the node library and everything else, but honestly, I’m completely lost. Is this by design, a bug, or something else?

Thank you in advance for any help!

light horizon
# sleek mica Hello everyone, I'm reaching out for your help. I'm trying to find a way to ad...

For normal types like the "My Class" you need to add the default value when creating the port:

value = ValueInput<MyClass>(nameof(value), new MyClass() /* Like this */);

Although I don't know if this will appear on the node correctly or at all since it is a custom class

for ports that you want to reference other objects you need to add the NullMeansSelf attribute and call NullMeansSelf on the value input like this:

  [DoNotSerialize]
  [NullMeansSelf] // Add this
  public ValueInput value;

  protected override void Definition()
  {
      value = ValueInput<Font>(nameof(value), null).NullMeansSelf() /* Call this method */;
  }

This only works for UnityObjects like components, Gameobjects, assets etc

sleek mica
#

@light horizon Thanks! Also, for LocalizedString, it’s a bit of a special case. Is there a way to create a custom property drawer just for this type?

#

Sorry to ask here, but I’ve already searched online and tried using AI, and I still couldn’t find an answer. You’re my last hope!

light horizon
sleek mica
#

Thanks, I’ll take a look!