Page 1 of 1
[Solved] Bark UI -> Set Order in Layer for each NPC.
Posted: Mon Oct 29, 2018 10:10 am
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!
Re: Bark UI -> Set Order in Layer for each NPC.
Posted: Mon Oct 29, 2018 10:41 am
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.
}
Re: Bark UI -> Set Order in Layer for each NPC.
Posted: Mon Oct 29, 2018 11:10 am
by Japtor
Hi,
Thank you! It worked!
Have a nice day!
Re: [Solved] Bark UI -> Set Order in Layer for each NPC.
Posted: Mon Oct 29, 2018 11:15 am
by Tony Li
Glad to help!