Bark UI targeting an object in Unity UI

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
kheper
Posts: 5
Joined: Fri Aug 07, 2020 1:22 pm

Bark UI targeting an object in Unity UI

Post by kheper »

Hi. I am working on a project that is done almost completely in Unity UI. I have a character in the interface who will randomly 'bark' at player actions. My problem is everything I've found related to barks target objects within the world or seem very old. I tried to make my own bark using Unity UI Bark UI which kind of works but there is a warning about this becoming obsolete. What is the best solution here?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark UI targeting an object in Unity UI

Post by Tony Li »

Hi,

Unity UI Bark UI was superceded in favor of Standard Bark UI, which works similarly but is improved. It works with any canvas type.

You can also implement the C# interface IBarkUI if you want to write your own.

If you have a specific issue, what's going on?
kheper
Posts: 5
Joined: Fri Aug 07, 2020 1:22 pm

Re: Bark UI targeting an object in Unity UI

Post by kheper »

I tried using the Standard Bark UI but it would reposition the bark to the bottom corner of the screen. I guess I will keep poking it until I can get it to work.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark UI targeting an object in Unity UI

Post by Tony Li »

Did you set the Canvas to Screen Space and set the position of the bark UI panel?

Here's an example exported from Unity 2019.3:

DS_ScreenSpaceBarkExample_2020-08-08.unitypackage
kheper
Posts: 5
Joined: Fri Aug 07, 2020 1:22 pm

Re: Bark UI targeting an object in Unity UI

Post by kheper »

Thanks for your help. I had the 'Keep in View' toggled on.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark UI targeting an object in Unity UI

Post by Tony Li »

Good catch. That's only for world space canvases. If you try to use it for a screen space canvas, it will try to move the panel into the camera's view in world space, but this will move it outside the canvas's screen space.
cptscrimshaw
Posts: 113
Joined: Sun Sep 20, 2020 8:21 pm

Re: Bark UI targeting an object in Unity UI

Post by cptscrimshaw »

In the process of attempting to move my Bark UI from world to screen space overlay because I have some post processing effects that are making the text unreadable when they are turned on. Before I dive further in to getting it looking right, is there a way to get the bark to follow the player in screen space overlay like it does with world space?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bark UI targeting an object in Unity UI

Post by Tony Li »

Hi,

You can still keep your bark UI in world space. Just put it on a layer that isn't affected by post processing. For example, set the bark UI's layer to "UI" and exclude the "UI" layer from post processing.

If you want to use screen space, the Extras page has two examples:
  • ScreenSpaceBubbleExample demonstrates a screen space bubble UI
  • The UI Smooth Follow package contains a script to make a screen space UI follow an object with damping, if you want that effect
Post Reply