Announcements, support questions, and discussion for the Dialogue System.
destrucity
Posts: 24 Joined: Mon Feb 11, 2019 6:29 pm
Post
by destrucity » Mon Feb 11, 2019 6:34 pm
I'd like to make a custom editor with a dropdown list composed of all of the actors in my main database.
I've tried this, but trying to access MasterDatabase (and masterDatabase) results in a null reference exception:
Code: Select all
public override void OnInspectorGUI()
{
var test = PixelCrushers.DialogueSystem.DialogueManager.MasterDatabase.actors;
}
Is there a way to access the actors in the masterDatabase in the editor? Thanks!
destrucity
Posts: 24 Joined: Mon Feb 11, 2019 6:29 pm
Post
by destrucity » Mon Feb 11, 2019 6:39 pm
It seems like a solution may be to use GameObject.FindObjectOfType<PixelCrushers.DialogueSystem.DialogueSystemController>()
but if there is a better way, please let me know!
Tony Li
Posts: 22056 Joined: Thu Jul 18, 2013 1:27 pm
Post
by Tony Li » Mon Feb 11, 2019 8:20 pm
Can you use the
[ActorPopup] attribute? This is the easiest way to present a dropdown list of actors.
Otherwise, since DialogueManager.masterDatabase is only valid at runtime, you can call EditorTools.FindInitialDatabase(), which returns the database that's assigned to the Dialogue Manager's Initial Database in the currently-open scene.
destrucity
Posts: 24 Joined: Mon Feb 11, 2019 6:29 pm
Post
by destrucity » Tue Feb 12, 2019 10:26 am
Wow that works great, talk about making it easy. Thanks!