Search Issue Tracker

Fixed in 0.51-preview.32

Votes

14

Found in [Package]

0.13.0-preview.24

Issue ID

1267157

Regression

No

Trying to serialize/deserialize an Entities World a second time fails if there are blob assets

Package: Entity Component System (ECS)

-

How to reproduce:
1. Open attached project "Unity Bugs.zip" and scene "SampleScene"
2. Enter Play mode
3. In Game view, click on the "Hit this 4 times" button 4 times
4. Observe Console window

Expected result: no errors are thrown
Actual result: multiple errors:
AssertionException: Assertion failure. Values are not equal. Expected: 0 == 1
ArgumentException: The entity does not exist
IndexOutOfRangeException: Index -1 is out of range of '65536' Length.
A Native Collection has not been disposed, resulting in a memory leak. Allocated from:

Reproducible with: 2020.1.1f1, 2020.2.0a20 (Entities 0.13.0-preview.24)
Not reproducible with: 2020.1.1f1 (Burst 1.3.0-preview.12, Entities 0.11.0-preview.7, Hybrid Renderer 0.5.1-preview.18)
Could not test with: 2018.4 (Entity package too old), 2019.4 (Entities 11-perview.17, NativeArray ReadOnly is not recognized errors), was not able to test with lower than Entities 0.13.0-preview.24 version reliably due to Package manager reverting Entity package to the newest version

  1. Resolution Note (fix version 0.51-preview.32):

    Cannot reproduce in 0.51 release -- likely fixed

Comments (1)

  1. JayTea173

    Mar 19, 2022 17:01

    I'm going to necro this, since this is still an issue in Entities 0.50. The problem I observed is that the entity header length changes when serializing the blobasset, as well as the validationptr being completely wrong, somewhere off in memory and not set to the constant value of an invalid pointer.

    But I've found a workaround:
    1. Copy the entities you want to serialize to another world.
    2. Make sure to remove BlobAssetOwner from these copied entities.
    3. Run Serialization.

    If you now deserialize those entities you should no longer get the error that the blob is unloaded/released/invalid.

    BlobAssetOwner is internal, so you'll have to use reflection or modify the entities package source to make the BlobAssetOwner public.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.