hjx1994 你好!我遇到一个内存泄漏的问题,在Skeleton Mecanim的Mask Interaction设置为Inside Mask时,运行时内存中会每帧不停创建相同的材质,导致内存泄漏,请问是我的spine资源导出有问题吗? 可以看到材质的数量在不停上升,在内存快照中有大量相同的材质 我的场景中只有一个spine物体,这个物体导入unity中有两个材质 请问是我哪里使用出错导致了这样的情况吗?期待回复
Spinebot 你好!在使用Skeleton Mecanim时,如果内存中不断创建相同的材质,可能是由于代码中某些地方错误地创建了新的材质实例。确保你使用的是最新版本的spine-unity运行时,因为旧版本可能存在已修复的bug。你可以尝试以下步骤来解决问题: 确保你使用的是最新的spine-unity运行时版本。可以从Spine Unity下载页面获取最新版本。 检查代码中是否有不必要的材质实例化操作,尤其是在动画播放或更新时。 如果你在运行时进行材质或纹理的动态修改,确保在不再需要时正确释放这些资源。可以使用AtlasUtilities.ClearCache()和Resources.UnloadUnusedAssets()来清理不再使用的资源。 如果问题仍然存在,建议创建一个最小的Unity项目来重现该问题,并检查是否在其他项目中也会出现相同的行为。
Misaki hjx1994 Please note that 4.3 is still a beta version, and skeleton data exported from the latest editor may not work correctly at runtime. If you are developing for production rather than testing, please use the latest stable version, 4.2.
Misaki hjx1994 I see, thank you for trying the 4.2 editor and runtime! In order to identify the cause of the issue, could you please send us the minimal Spine project that reproduces the issue via email?: contact@esotericsoftware.com Please include the URL of this forum thread in the email so we know the context. Then we can take a look at what's wrong.