No dialogue selected

First time i click a dialogue scriptable object i get “no dialogue selected”. if i then keep clicking on it i get the same message but if i selected an other dialogue scriptable object then the node text will show up. If i go back to the other dialogue scriptable object now this node texts will show up. Whats going on here?

The problem is that when we double click on a dialogue to open the dialogue editor, we’re not actually telling the new window what to display. For that, we need a new method that takes in a dialogue as a parameter and sets teh new window’s selected dialogue.

        public static void ShowEditorWindow()
        {
            GetWindow(typeof(DialogueEditor), false, "Dialogue Editor");
        }

        public static void ShowEditorWindow(Dialogue dialogue)
        {
            var window = GetWindow(typeof(DialogueEditor), false, "Dialogue Editor") as DialogueEditor;
            window.selectedDialogue = dialogue;
        }
        
        [OnOpenAsset(1)]
        public static bool OnOpenAsset(int instanceID, int line)
        {
            Dialogue dialogue = EditorUtility.InstanceIDToObject(instanceID) as Dialogue;
            if (dialogue != null)
            {
                ShowEditorWindow(dialogue);
                return true;
            }
            return false;
        }

that worked thnx!

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

Privacy & Terms