• Runtimes
  • Spine issues with FixDrawOrder

  • Изменено
Related Discussions
...

it is happened when the spine object is deactivated and the mesh render is disabled

NullReferenceException: Object reference not set to an instance of an object
Spine.Unity.SkeletonRenderer.SetMaterialSettingsToFixDrawOrder () (at Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs)

meshRenderer.sharedMaterials[i].enableInstancing = false;

fixed with this:

for (int i = 0; i < meshRenderer.sharedMaterials.Length; ++i) {
            if ( null == meshRenderer.sharedMaterials[i] )
               continue;
            if (!hasPerRendererBlock) meshRenderer.GetPropertyBlock(reusedPropertyBlock, i);
            // Note: this parameter shall not exist at any shader, then Unity will create separate
            // material instances (not in terms of memory cost or leakage).
            reusedPropertyBlock.SetFloat(SUBMESH_DUMMY_PARAM_ID, i);
            meshRenderer.SetPropertyBlock(reusedPropertyBlock, i);

        meshRenderer.sharedMaterials[i].enableInstancing = false;
     }

Thanks for reporting. A commit has been pushed to the 3.8 branch. This commit will be included in the next 3.8 unitypackage and merged to the 4.0-beta branch soon.

5 месяцев спустя

Thanks for the quick fix