Announcements, support questions, and discussion for the Dialogue System.
nicmar
Posts: 133 Joined: Wed Aug 21, 2019 2:39 am
Post
by nicmar » Thu Aug 29, 2019 3:50 pm
I need to run some code when DialogueSystem have been initalized. I can see this code in DialogueSystemController:
Code: Select all
public event System.Action initializationComplete = delegate { };
How do I subscribe to that event from another class?
I also tried to read
Code: Select all
if (DialogueSystemController.isInitialized)
but I guess I need a reference to the actual dialogueManager instance.
EDIT: I just found
Code: Select all
DialogueManager.instance.isInitialized
, but an event would probably be more efficient than polling
Thank you!
Working on
SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on
@BlueGooGames .
Tony Li
Posts: 22055 Joined: Thu Jul 18, 2013 1:27 pm
Post
by Tony Li » Thu Aug 29, 2019 4:40 pm
Hi,
Code: Select all
DialogueManager.instance.initializationComplete += OnInitializationComplete;
void OnInitializationComplete() {
Debug.Log("Dialogue Manager is initialized");
}
Or just wait until the end of the frame. (The Dialogue System initializes in Start().)
Code: Select all
IEnumerator Start() { // No event needed.
yield return new WaitForEndOfFrame();
Debug.Log("Dialogue Manager is initialized");
}