Page 1 of 1
Bark UI size
Posted: Mon May 16, 2016 12:07 pm
by creddie
Hello,
I'm using a bark UI to make something like a cartoon speech bubble. My problem is I can't find the size of the text bubble. It updates correctly with changing text, but it doesn't show in the editor and I can't find its dimensions.
Re: Bark UI size
Posted: Mon May 16, 2016 12:49 pm
by Tony Li
Hi,
What GUI system are you using? The new Unity UI, the old legacy Unity GUI, or another? If the bark UI uses "Unity
UI Bark UI", it's the new Unity UI. If it uses "Unity Bark UI", it's legacy Unity GUI.
If you're using Unity UI, the bark UI is a world space canvas. Inside it is a panel that uses a
Content Size Fitter to adjust to the size of the text. You can resize it using the standard Unity UI tools. For more info on them, see Unity's
UI tutorials.
If you get stuck, let me know. I can try to help.
Re: Bark UI size
Posted: Mon May 16, 2016 1:20 pm
by creddie
Thanks for your reply. I'm using the new Unity UI. Where is the world space canvas, is it being created at runtime? I can't find it in the scene view or the hierarchy. My goal is to copy the size onto a separate UI object and scale it up a bit to make a border for a comic word bubble.
Re: Bark UI size
Posted: Mon May 16, 2016 3:05 pm
by Tony Li
The bark UI (including its world space canvas) should be a child GameObject of the barking character. To see this in action, open the scene Assets > Dialogue System > Examples > Unity UI Examples > Generic UI Example SCene. Then inspect the NPC named "Sergeant Graves".
A quick way to add a bark UI to a character is to navigate to this folder in the Project view: Assets > Dialogue System > Prefabs > Unity UI Prefabs > Generic. Then drag the
Generic Unity UI Bark UI prefab onto your character in the Hierarchy view. This will add an instance as a child GameObject. To see it in the scene view, inspect it and set the Canvas Group's Alpha value to 1. (It's initially set to 0 to allow it to fade in and out nicely.) Then you can customize it by replacing the default panel image with a comic word bubble and increasing the border area.
As a fine-tune tweak, if your bubble has a tail, you might want to make it a separate image, anchored to the bottom of the main bubble image. This way you can set it up so that it won't scale its width along with the main bubble's width.
Here's the reference on
How to Set Up a Unity UI Bark UI
Re: Bark UI size
Posted: Mon May 16, 2016 3:49 pm
by creddie
Currently my settings are different, all actors use a single bark UI that is a separate prefab in the scene, but there is no canvas child on the bark UI. There are multiple canvases in the scene, but they are children of other objects. Still, when I play, the word bubble is drawn correctly in the game view, though it seems invisible in the scene view and hierarchy. Since it's being drawn, is there a way to access the dimensions without changing the setup?
Re: Bark UI size
Posted: Mon May 16, 2016 8:51 pm
by Tony Li
First, to get it clear in my head, you're talking about barks, not conversations, correct?
How are you triggering the barks?
It sounds like you're using a screen space canvas. To find it, try this:
1. As soon as a character barks, pause the game.
2. In the Hierarchy view's search bar (upper right), enter: UnityUIBarkUI
3. This should show the GameObject that has the UnityUIBarkUI. Select this GameObject. Then mouse over the Scene view, and press 'F' to focus on it.
Please feel free to post screenshots that you think might illustrate what's going on, or send an example to tony (at) pixelcrushers.com and let me know what version of Unity to use. I'll be happy to take a look.