Page 1 of 1

How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 7:47 am
by OutbackGames
Hi, I'm trying to find the editor script that handles the inspector for Standard UI Subtitle Panel. The reason being is so that I can add a new field for the Profile Panel parent allowing me to Hide the profile and name if the character is reading a sign and not talking to an NPC but Show the panel when talking to an NPC/Actor.

I've implemented the code already for hiding and showing the profile panel, I just need the ability to show the field in the inspector for the parent object holding the profile images and I can't find the custom inspector script for it.

Re: How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 9:27 am
by Tony Li
Hi,

The custom inspector scripts for the Standard Dialogue UI components are in Plugins / Pixel Crushers / Dialogue System / Scripts / Editor / UI / Standard UI / Dialogue UI. You can make a subclass of StandardUISubtitlePanelEditor and override OnInspectorGUI to add more inspector fields. Example:

Code: Select all

[CustomEditor(typeof(MyCustomSubtitlePanel), true)]
public class MyCustomSubtitlePanelEditor : StandardUISubtitlePanelEditor
{

    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        
        serializedObject.Update();
        EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(MyCustomSubtitlePanelEditor.myCustomField), true);
        serializedObject.ApplyModifiedProperties();
    }
}

Re: How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 9:32 am
by OutbackGames
Weird, I don't have that heirarchy.
I've got:

Plugins -> Pixel Crushers -> Dialogue System: then the following subfolders.
Demo,
Prefabs,
Resources,
Templates,
Thirdparty Support,
Wrappers
00000000.png
00000000.png (38.95 KiB) Viewed 330 times

Edit:

Ah cheers for posting the file name, thanks :)

Re: How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 9:38 am
by Tony Li
Out of curiosity, where did the Scripts folder end up?

Re: How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 9:45 am
by OutbackGames
Ah it appears to have been in the prefabs folder.
prefabs -> Standard UI Prefabs -> Pro -> Scripts -> Editor

Re: How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 10:00 am
by Tony Li
Hmm, maybe an accidental mouse drag. As long as you keep the Scripts folder somewhere within the Plugins folder, it's fine to leave it there or move it back to its original position.

Re: How To Add New Serialized Editor Fields to Standard UI Subtitle Panel Script?

Posted: Fri Mar 19, 2021 10:03 am
by OutbackGames
Possibly, could have also been another team member thanks though :)