NinjaDog

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;
}
NinjaDog
  • Postovi: 23

Harald

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.
Avatar
Harald

Harri
  • Postovi: 3992

NinjaDog

Thanks for the quick fix
NinjaDog
  • Postovi: 23


Natrag na Runtimes