Bark UI offset not working
Bark UI offset not working
Hello, changing the bark UI offset in the dialogue actor doesn't actually affect the position of the bark UI. Working in 2D, bark canvas set to screen space - overlay.
Re: Bark UI offset not working
Hi,
The Dialogue Actor's offset should still apply, but the bubble bark prefab also has an internal offset on its Main Panel GameObject. If you're using the bubble bark prefab, you can duplicate it, set the Main Panel's Y Pos to 0, and assign the duplicate to the Dialogue Actor (either as a prefab or a child). (I'd do this to the original prefab, but many existing games use the bark UI as-is, so I don't want to impact the positions in their games.)
The Dialogue Actor's offset should still apply, but the bubble bark prefab also has an internal offset on its Main Panel GameObject. If you're using the bubble bark prefab, you can duplicate it, set the Main Panel's Y Pos to 0, and assign the duplicate to the Dialogue Actor (either as a prefab or a child). (I'd do this to the original prefab, but many existing games use the bark UI as-is, so I don't want to impact the positions in their games.)
Re: Bark UI offset not working
Hello, thank you for the reply. I was using the Standard Bark UI, but have the same problem when trying with the Bubble UI. The offset works in World Space, but not in Screen Space for me.
Re: Bark UI offset not working
Sorry, I forgot you said screen space. If you have an offset of 2, the offset will only move 2 pixels. Instead, use this script:
UIFollow.cs
1. Remove the Always Face Camera component. (This only applies to world space.)
2. UNtick the StandardBarkUI component's Keep In View checkbox. (This only applies to world space.)
3. Set the child panel's Pivot to 0.5, 0.5
4. Add UIFollow it to your bark UI's child panel. Set the fields to:
UIFollow.cs
Code: Select all
using UnityEngine;
public class UIFollow : MonoBehaviour
{
[SerializeField] private Transform followThis;
[SerializeField] private RectTransform container;
[SerializeField] private RectTransform ui;
[SerializeField] private Vector3 offset;
private void LateUpdate()
{
var screenPoint = RectTransformUtility.WorldToScreenPoint(Camera.main, followThis.position + offset);
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(container, screenPoint, null, out localPoint);
ui.anchoredPosition = localPoint;
}
}
1. Remove the Always Face Camera component. (This only applies to world space.)
2. UNtick the StandardBarkUI component's Keep In View checkbox. (This only applies to world space.)
3. Set the child panel's Pivot to 0.5, 0.5
4. Add UIFollow it to your bark UI's child panel. Set the fields to:
- Follow This: Main GameObject (e.g., NPC)
- Container: bark UI
- UI: child panel
- Offset: Offset in world units (e.g., 0,2,0)
Re: Bark UI offset not working
That worked, thank you!
Re: Bark UI offset not working
Glad to help!