• RuntimesUnity
  • 加载时卡顿, SkeletonRenderer.Awake方法


如图, 运行时加载prefab, 会出现图中的问题, 最终导致30帧-->15帧.
是我的操作有什么问题吗?

这个是有问题的prefab.
可能所有的prefab都有问题, 我仅仅只是列举这一个




Related Discussions
...

根据您提供的情况,加载时出现卡顿和帧数下降的问题可能与几个因素有关。首先,需要确认您的角色或者使用的Spine骨架的顶点数或骨骼数是否非常高,这可能是导致SkeletonRenderer.Awake方法加载时间长,从而影响性能的原因之一。在Memory Heap SkeletonRenderer的讨论中提到,如果有两个不同的Spine骨架(SkeletonRenderer.Awake被调用两次),您可以尝试识别是哪一个造成了问题。

此外,如果您在使用SkeletonGraphic组件,并且遇到了性能问题,Skeleton Graphic WebGL performance issues的讨论建议在GameObject被禁用时,Unity不会调用Awake()方法,直到它被启用。这可能不是您想要的大多数情况。因此,一个解决方法可能是开始时将GameObject启用,然后立即在Start()调用中禁用它。另一个解决方法是禁用SkeletonGraphic组件(和其他组件),因为这确实会调用Awake()方法,与禁用GameObject相反。

如果您的问题与上述情况不符,建议进一步检查您的Spine资源和Unity项目设置,以确保一切配置正确。由于您的问题描述较为具体,而且涉及到性能优化,通常需要详细分析项目的具体情况才能找到最佳解决方案。

  • Init ответили на это сообщение.

    Spinebot
    没有使用 SkeletonGraphic 组件.

    Spinebot 有两个不同的Spine骨架

    我该如何确认是否存在两个不同的Spine骨架? 实际上只是使用spine制作了序列帧动画. "Skeleton"和"slot
    "只有一个.

    Spinebot 需要确认您的角色或者使用的Spine骨架的顶点数或骨骼数是否非常高

    就像我在第一张图里展示的那样, 更多的消耗在于读取skeleton.atlas.txt文件. 我不确定是否能确认为顶点数或骨骼数非常高

    @Init You may want to checkout the following section of the spine-unity documentation:
    https://zh.esotericsoftware.com/spine-unity#%E6%80%A7%E8%83%BD%E9%97%AE%E9%A2%98
    SkeletonData has to be loaded once. In short: you may want to use binary .skel.bytes files for faster loading, and use pre-loading of your skeleton e.g. at level start time (or any other not so critical timepoint) instead of loading it at a critical gameplay time point.

    • Init ответили на это сообщение.

      Harald
      Thank you for your reply. The issue has been resolved, but not using the suggestion you provided. When I was planning to use your suggestion, we held a meeting where we reviewed the updates that occurred a few days before and after the issue arose. We found that the problem occurred while I was using coroutines to load map resources. When I removed the coroutine code, the problem disappeared.

      1.Changed the loading from one texture per frame to three textures per frame
      2.The issue occurred
      3.Reverted to loading one texture per frame
      4.The issue disappeared

      希望能有所帮助

      • Init ответили на это сообщение.
      • Harald оценил это.

        Init
        补充,

        Init 1.Changed the loading from one texture per frame to three textures per frame

        Implemented using Unity coroutines to change from loading one texture per frame to loading three textures per frame.

        • Init ответили на это сообщение.

          Init 使用协程, 每帧加载一张texture, 变更为, 使用协程每帧加载三张texture

          @Init Very glad to hear you could resolve the issue! Thanks for sharing your insights.