Getting [Error] Destroying assets is not permitted to avoid data loss in Unity 6 / Shapes 4.5.0 in the Editor

Avatar

Hi when I play my scene in the Unity 6 editor (with Shapes 4.5.0), I am getting the following error when I stop the scene. This didn't happen previously when I was on Unity 2022.3.x and Shapes 4.3.x. This can be reproduced by opening the Shapes Gallery sample scene.


[Error] Destroying assets is not permitted to avoid data loss.

If you really want to remove an asset use DestroyImmediate (theObject, true);

Object.Destroy()

ShapesExtensions.TryDestroyInOnDestroy() at /Shapes/Scripts/Runtime/Utils/ShapesExtensions.cs:84

82: }; // execute late in this editor frame, if still not playing

83: else

--> 84: Object.Destroy( obj );

85: #else

86: Object.Destroy( obj );

ShapeRenderer.TryDestroyInstancedMaterials() at /Shapes/Scripts/Runtime/Components/ShapeRenderer.cs:382

380: if( instancedMaterials[i] != null ) {

381: if( inOnDestroy )

--> 382: this.TryDestroyInOnDestroy( instancedMaterials[i] );

383: else

384: instancedMaterials[i].DestroyBranched();

ShapeRenderer.OnDestroy() at /Shapes/Scripts/Runtime/Components/ShapeRenderer.cs:349

347: this.TryDestroyInOnDestroy( rnd );

348: this.TryDestroyInOnDestroy( mf );

--> 349: TryDestroyInstancedMaterials( inOnDestroy: true );

350: }

Reporting a bug? please specify Unity version:
6000.0.28
Reporting a bug? please specify Shapes version:
4.5.0
Reporting a bug? please specify Render Pipeline:
URP