• International中文
  • 新手,该如何在Unity运行时获取包围盒的大小和锚点

新手,该如何在Unity运行时获取包围盒的大小和锚点?

    Related Discussions
    ...

    CLXiao 实际上是Unity的MeshFilter组件对象的mesh.bounds的size和center。

      RalphYDY 我是想在Load资源的时候就获取到给UI上用的,要设置宽高和位置。不过刚刚已经通过skeleton.GetBounds()方法获取到想要的东西了。感谢!

      感谢@RalphYDY 的插话!

      @CLXiao 很高兴听到您已经弄清楚了,感谢您告诉我们。

      如果您使用的是 SkeletonGraphic,请注意 [SkeletonGraphic.MatchRectTransformWithBounds()](https://github.com/EsotericSoftware/spine-runtimes/blob/4.1/spine-unity/Assets/Spine/Runtime/ spin-unity/Components/SkeletonGraphic.cs#L738)也可能是一个很好的参考,以防万一您遇到边界计算的任何问题。



      Thanks @RalphYDY for chiming in!

      @CLXiao Glad to hear you've figured it out, thanks for letting us know.

      If you're using SkeletonGraphic, please note that SkeletonGraphic.MatchRectTransformWithBounds() might be a good reference as well, just in case you encounter any problems with bounds computations.