[Solved] Bark UI -> Set Order in Layer for each NPC.

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

[Solved] Bark UI -> Set Order in Layer for each NPC.

Post by Japtor »

Hi,

Inside some NPCs, I have attached a Dialogue Actor Script -> Bark UI settings -> Bark UI -> Bubble Template Standard Bark UI prefab. Is there a way I could modify for each of them the Canvas-> Order in Layer number?

Thanks! :)
Last edited by Japtor on Mon Oct 29, 2018 11:10 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark UI -> Set Order in Layer for each NPC.

Post by Tony Li »

Hi,

There are two ways:

1. You can add an instance of the bark UI to each NPC, and assign the instance to the Dialogue Actor. The NPC's Dialogue Actor will use this instance instead of creating its own instance of the prefab. Set each instance's Canvas -> Order in Layer.

2. Or add a script to the NPC. In Start(), wait one frame for the Dialogue Actor to instantiate the prefab, and then set the DialogueActor's barkUISettings.barkUI's Order In Layer:

Code: Select all

IEnumerator Start() {
    yield return null;
    var barkCanvas = GetComponent<DialogueActor>().barkUISettings.barkUI.GetComponentInChildren<Canvas>();
    barkCanvas.sortingOrder = ###; // Some value.
}
Japtor
Posts: 120
Joined: Thu Jun 28, 2018 1:41 pm

Re: Bark UI -> Set Order in Layer for each NPC.

Post by Japtor »

Hi,

Thank you! It worked! :)

Have a nice day!
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: [Solved] Bark UI -> Set Order in Layer for each NPC.

Post by Tony Li »

Glad to help!
Post Reply