Canvas reference?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

Canvas reference?

Post by Japtor »

Hi,

Simple question.

Does the Dialogue Manager have a variable with a reference to its canvas? I will like to change its values through "play mode". I have been searching for it in the documentation, but I am not really sure if I found the correct answer.

Thanks! :)
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Canvas reference?

Post by Tony Li »

Hi,

No, it doesn't. This is because the Dialogue Manager doesn't always require a canvas. If you're using NGUI or legacy Unity GUI, they don't use Canvas. And it's also possible for the Dialogue Manager to point to a dialogue UI in a canvas that's not a child of the Dialogue Manager.

However, if your Dialogue Manager has one Instantiate Prefabs component, you can find use it to get the canvas:

Code: Select all

Canvas canvas = DialogueManager.instance.GetComponent<InstantiatePrefabs>().parent.GetComponent<Canvas>();
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

Re: Canvas reference?

Post by Japtor »

Hi,

All right!

Thanks for the answer. :)
Post Reply