Page 1 of 1

Bark UI targeting an object in Unity UI

Posted: Fri Aug 07, 2020 1:31 pm
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?

Re: Bark UI targeting an object in Unity UI

Posted: Fri Aug 07, 2020 1:47 pm
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?

Re: Bark UI targeting an object in Unity UI

Posted: Sat Aug 08, 2020 1:27 am
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.

Re: Bark UI targeting an object in Unity UI

Posted: Sat Aug 08, 2020 9:08 am
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

Re: Bark UI targeting an object in Unity UI

Posted: Sun Aug 09, 2020 10:36 am
by kheper
Thanks for your help. I had the 'Keep in View' toggled on.

Re: Bark UI targeting an object in Unity UI

Posted: Sun Aug 09, 2020 12:10 pm
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.

Re: Bark UI targeting an object in Unity UI

Posted: Sat Jan 09, 2021 5:03 pm
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?

Re: Bark UI targeting an object in Unity UI

Posted: Sat Jan 09, 2021 5:33 pm
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