• 中文
  • Unity中使用Spine,资源打包成Assetbundle之后,skeletonDataAsset 属性值变为 nul

Related Discussions
...

项目中只有一个骨骼动画时,没任何问题。
当我继续导入多个动画时,打包成Assetbundle之后,skeletonDataAsset 属性值变为 null,PC模式下运行是正常的,到Andriod模式下skeletonDataAsset为null,同时SkeletonAnimation.state也为null。




你使用哪个Unity版本?
您使用的是哪个版本的Spine和Spine-Unity运行时(unitypackage的名称)?

可能是SkeletonDataAsset与引用它的SkeletonAnimation位于不同的资产包中吗?


Which Unity version are you using?
Which versions of Spine and the Spine-Unity runtime (the name of the unitypackage) are you using?

Can it be that the SkeletonDataAsset is in a different asset bundle than the SkeletonAnimation that referenced it?

Unity版本号是:5.6.5f1
Spine版本号是:3.7.94PRO
Unity-Spine运行库版本号是:spine-unity-3_7-2019-06-19.unitypackage

谢谢你的信息。
Thanks for the information.

在最近的3.8-beta版本中可能已经隐式修复了此问题,因为某些更改仅适用于3.8。
This problem might already implicitly be fixed in the recent 3.8-beta versions, since some changes have been applied to 3.8 only.

你能否检查一下SkeletonDataAsset是否与引用它的SkeletonAnimation属于不同的资产包?
Could you please also check if the SkeletonDataAsset is in a different asset bundle than the SkeletonAnimation that referenced it?

SkeletonDataAsset与引用它的SkeletonAnimation确实不在同一个asset bundle里面


我已使用了3.8-bata版本的运行库,结果跟我的Unity不兼容,能不能在3.7版本运行库修复这个问题?

SkeletonDataAsset与引用它的SkeletonAnimation确实不在同一个asset bundle里面

如果它们不在同一个包中,你是否加载了两个包?
If they are not in the same bundle, have you loaded both bundles?

如果捆绑包之间的引用有时会被破坏,这似乎更像Unity的问题或资产包的加载方式与脊椎运行时相关
If references between bundles are sometimes broken, this seems more like a problem with Unity or how the asset bundles are loaded than related to the spine runtime

我使用了3.8-bata版本的运行时,结果与我的Unity不兼容。 我可以在3.7运行时修复此问题吗?
I have used the 3.8-bata version of the runtime, and the results are not compatible with my Unity. Can I fix this in the 3.7 runtime?

结果哪种方式与Unity版本不兼容/不兼容?
In which way were the results not working / not compatible with your Unity version?

3.8-bata版本运行库和Unity5.6.5不兼容


不同的资源包已经正确加载了,在Assets里面是可以看到的

而SkeletonAnimation在scene中寻找,所以没有找到

您能否向我们发送一个最小的项目作为zip包,向contact@esotericsoftware.com显示您的问题? 然后我们可以看看为什么引用会丢失。

Could you please send us a minimal project as zip package that shows your problem to contact@esotericsoftware.com? Then we can have a look why the reference gets lost.

现在可以确定,是animation与skeletonAssetData分开打包的原因

你能解决这个问题吗?
Have you been able to resolve the problem?

如果没有,您可以向我们发送一个最小的项目作为zip包,向contact@esotericsoftware.com显示您的问题。然后我们可以看看为什么引用会丢失。
If not, you could send us a minimal project as zip package that shows your problem to contact@esotericsoftware.com. Then we can have a look why the reference gets lost.

目前项目过大,等我精简之后发给你,谢谢

谢谢,我们已收到您的电子邮件。 一旦我们找到问题的原因,我会尽快回复您。
Thank you, we have received your email. I will get back to you as soon as we have found out the cause of your problem.

😃 😃 问题已解决,谢谢官方的大力支持。

很高兴听到你可以解决问题! 感谢您让我们知道!
Glad to hear you could resolve the problem! Thanks for letting us know!

2 年 后

您好,我遇到了与您描述相同的问题,在手机上面的spine我们是做成预制体,直接加载的预制体,依赖的skeletonDataAsset是绑好的,但是加载完成预制体后真机上断点调试发现Skeleton以及SkeletonDataAsset都为Null,看到您在论坛下面提及已经解决这个问题了,故发此贴,希望您可以告知问题所在

不幸的是,用户在没有告诉我们问题是什么的情况下解决了这个问题。 我们当时的邮件回复是:

“我现在看过你的项目,不幸的是它太大了,无法在合理的时间内进行分析。请从你的项目中删除所有分散注意力的加载逻辑,直到只剩下导致实际问题的部分。”

您是否在资产包中包含了所有 6 个(或更多)骨架资产? 它需要包含纹理、.atlas.txt 文件、.json.skel.bytes 文件以及三个或更多生成的资产(材质、SkeletonDataAsset 和 AtlasAsset)中的所有内容。 如果您将它们拆分为多个资产包,则需要在加载后通过脚本分配引用。


Unfortunately the problem has been fixed by the user without telling us what the issue was. Our email reply back then was:

"I have now had a look at your project, unfortunately it is far too large to be analysed in reasonable time. Please remove all distracting loading logic from your project until only the parts which are causing the actual problem are remaining."

Did you include all 6 (or more) skeleton assets in your asset bundle? It needs to include everything from the textures, the .atlas.txt file, the .json or .skel.bytes file and the three or more generated assets (the materials, the SkeletonDataAsset and the AtlasAsset). If you split these across multiple asset bundles, you will need to assign references via script after loading.

是的,资产是全部添加进去了,在加载依赖资源时是全部加载进去,但是这个问题并不会每次都出现,加载多个spine,使用不同的顺序就会出现不同的spine丢失skeletonDataAsset,目前我们定位到的问题是在加载依赖资源skeletonDataAsset以及_atlas时找不到他们的assetBundle

我不确定我是否正确理解了您的回复,机器翻译有点模棱两可。

您提到问题并非每次都会发生,并且取决于加载顺序。 为什么要将单个骨架的资产放入多个不同的资产包中? 我看到材质、图集资产和骨架数据资产的单独资产包。 我们建议将这些依赖资产捆绑在一个资产包中。


I'm not sure I understood your reply correctly, machine translation was a bit ambiguous.

You mentioned that the problem does not occur every time and that it depends on load order. Why do you put the assets of a single skeleton into multiple different asset bundles? I see separate asset bundles for the Material, the atlas asset and the skeleton data asset. We would recommend to bundle these dependent assets together in a single asset bundle.

7 天 后

非常感谢您的回复,我将所有的依赖资产全部打在一个包里面问题就解决了。