Search Unity

BlobAssetReferences inside of other BlobAssetReferences not properly maintained in SubScene conversi

Discussion in 'Entity Component System' started by Katerpilet, Jun 9, 2020.

  1. Katerpilet

    Katerpilet

    Joined:
    Aug 2, 2015
    Posts:
    87
    I had some code that looked like this:

    Code (CSharp):
    1.     public struct Flocker : IComponentData
    2.     {
    3.         public BlobAssetReference<MovementDataBlob> MovementData;
    4.     }
    Inside MovementDataBlob this was defined:

    Code (CSharp):
    1. public struct MovementDataBlob
    2. {
    3.     public BlobAssetReference<AnimationCurveBlob> AccelerationCurve;
    4.     public BlobAssetReference<AnimationCurveBlob> DecelerationCurve;
    5. }
    When everything was in a single scene everything worked fine, once I switched to SubScene conversion, the animation curves asset reference could not be loaded due to being undefined.

    When I changed the Flocker struct to directly reference the animation curve references like so, everything works:

    Code (CSharp):
    1.     public struct Flocker : IComponentData
    2.     {
    3.         public BlobAssetReference<MovementDataBlob> MovementData;
    4.         public BlobAssetReference<AnimationCurveBlob> AccelerationCurve;
    5.         public BlobAssetReference<AnimationCurveBlob> DecelerationCurve;
    6.     }
    My guess is that there is an error in the ref-counting in SubScene's which does not maintain blob data for assets that are reference in assets that already are blob references.
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    BlobAssets can not reference other blob assets. It is not supported because it would mean that blob assets are not immutable / memory ready anymore.
     
  3. Katerpilet

    Katerpilet

    Joined:
    Aug 2, 2015
    Posts:
    87
    Thanks for clarifying! It would be nice if there was an error that showed up. The disparity in functionality between runtime and edit time was always confusing.