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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OutbackGames
Posts: 14
Joined: Fri Mar 19, 2021 7:38 am

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

Post 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.
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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();
    }
}
OutbackGames
Posts: 14
Joined: Fri Mar 19, 2021 7:38 am

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

Post 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 323 times

Edit:

Ah cheers for posting the file name, thanks :)
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Out of curiosity, where did the Scripts folder end up?
OutbackGames
Posts: 14
Joined: Fri Mar 19, 2021 7:38 am

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

Post by OutbackGames »

Ah it appears to have been in the prefabs folder.
prefabs -> Standard UI Prefabs -> Pro -> Scripts -> Editor
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
OutbackGames
Posts: 14
Joined: Fri Mar 19, 2021 7:38 am

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

Post by OutbackGames »

Possibly, could have also been another team member thanks though :)
Post Reply