Adding new and unique Dialogue nodes through inspector

I would like to add nodes through the inspector but when I do it’s not triggering the generation of a guid because it’s not calling the MakeNode method of Dialogue.cs It’s just making a duplicate.

It looks like OnValidate gets called when I create a new one, but I can’t figure out how to get a reference to just the newly created node so I can’t do any initialization on it.

I know I can always look at the last item in the list but I only want to perform an action on it when it’s been newly created through the inspector’s + symbol.

Any tips???

Writing a custom inspector would be the best way to make sure this happens. It’s still not the ideal way of adding a DialogueNode because in addition to updating the UUID, we also need to set parent child relationships, etc, which is what the EditorWindow is best suited to do.
TBH, if I were to make a custom editor for the Dialogue’s inspector, it would hide the nodes altogether and simply have a button to open the DialogueEditorWindow and select that dialogue.

Interesting. Ok let me describe the problem I’m trying to solve.

  1. I was thinking of going with multiple root Dialogue nodes (like Diablo) where the player can select the starting point of the conversation right away. In this case I don’t care about parent-child relationships between nodes. (just that a DialogueNode SO is a child asset of the Dialogue SO). But this is not critical since I can still do this in the custom editor.

  2. I have a use case unrelated to Dialogues where I wanted to take advantage of parent child relationships between two different classes of SOs. My use case is simple and doesn’t require a custom editor (it would help but it’s not critical). But I wanted to use the asset database structure to keep things organized between the “Node” SO and the Parent SO.

For (2) is the answer basically to create a custom editor?

Yes, I would say a custom editor would be the best approach here. The built in editor simply isn’t going to trigger the things you need it to.

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

Privacy & Terms