• Unity
  • Spine bounding box for UI Events

Related Discussions
...
foriero yazdı

Harald, may I ask you to have this ui bounding box follower done first? Thank you.

Ok, no problem.

bir ay sonra

Look forward. No more headaches with UI events. :-) Let me know if I can be of any help in this. Important feature for all people who create UI with Spine.

This feature has just been implemented, a new 3.8 unitypackage is available for download here as usual:
Spine Unity Download

From the changelog:

Changelog.md yazdı
  • Added BoundingBoxFollowerGraphic component. This class is a counterpart of BoundingBoxFollower that can be used with SkeletonGraphic.
  • Added Inspector context menu functions SkeletonRenderer - Add all BoundingBoxFollower GameObjects and SkeletonGraphic - Add all BoundingBoxFollowerGraphic GameObjects that automatically generate bounding box follower GameObjects for every BoundingBoxAttachment for all skins of a skeleton.

KUDOS. THANK YOU. :-) We are on 4.x :-)


Any chance to have it in 4.x soon?

No, sorry.

Just kidding 😉


Regarding planned changes for the 4.0 runtime:
The separate codepaths and components for SkeletonRenderer and SkeletonGraphic will be combined to a new common baseclass, so later the BoundingBoxFollower and BoundingBoxFollowerGraphic will be combined to a single component that can handle both cases. Just so you are prepared to change your code again later.

Nice job there! Congrats!

"Space war against Illiteracy and Dyslexia" 😃
Greatly appreciated, I hope that this leads to more people being able to read documentation pages in the future 😉.


A new 4.0-beta unitypackage has just been released:
Spine Unity Download

Harald yazdı

Greatly appreciated, I hope that this leads to more people being able to read documentation pages in the future 😉.

:nyeh:

@foriero The game looks GREAT! Good job!

Assets/Git/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerGraphicInspector.cs(36,7): error CS0246: The type or namespace name 'Boo' could not be found (are you missing a using directive or an assembly reference?)

Assets/Git/Spine/Editor/spine-unity/Editor/Components/BoundingBoxFollowerGraphicInspector.cs(236,17): error CS0246: The type or namespace name 'List<>' could not be found (are you missing a using directive or an assembly reference?)


Trying to intercept UI events but seems like it does not work with current implementation of BoundingBoxFollowerGraphics. Any missing part?

using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class TTUIEvents : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler
{
    public Button.ButtonClickedEvent OnClick;
    public Button.ButtonClickedEvent OnDown;
    public Button.ButtonClickedEvent OnUp;
    public Button.ButtonClickedEvent OnEnter;
    public Button.ButtonClickedEvent OnExit;
    
public void OnPointerClick(PointerEventData eventData) => OnClick.Invoke();
public void OnPointerEnter(PointerEventData eventData) => OnEnter.Invoke();
public void OnPointerExit(PointerEventData eventData) => OnExit.Invoke();
public void OnPointerDown(PointerEventData eventData) => OnDown.Invoke();
public void OnPointerUp(PointerEventData eventData) => OnUp.Invoke();
}

Oh, thanks for reporting the compile error, this one did not show up in our setup and the package build setup (I assume the using boo.lang statement caused troubles when building an executable, right?). I have replaced it by the proper System.Collections.Generic namespace usage.

Fixes are up for both the 3.8 and 4.0-beta packages:
Spine Unity Download

Regarding the UI events:
Did you enable Is Trigger at the PolygonCollider objects?

I take source directly from github, not using packages at all. :-) Yes let me try Is Trigger.


In case there is no SkeletData assigned

NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.BoundingBoxFollowerGraphic.Initialize (System.Boolean overwrite) (at Assets/Git/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs:118)
Spine.Unity.BoundingBoxFollowerGraphic.OnEnable () (at Assets/Git/Spine/Runtime/spine-unity/Components/Following/BoundingBoxFollowerGraphic.cs:80)

Thanks for reporting. Your use cases are strange, but we are happy to handle that 🙂. A commit is pushed to the 3.8 branch, it will soon be on the 4.0 branch as well.