blobassetstore native collection disposal

So I have a class where I instanciate some prefabs in a class at startup. This line is causing errors, it is in the start function of the class.

var settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, new BlobAssetStore());

I know I need to dispose of the blobassetstore/native collection, but I am not sure how or where to do it. I tried several different places but none seemed to take care of it. Do I need to declare it differently?

I think this issue is causing another issue. I later during run-time try to instanciate a bullet prefab but all it does it instansiate another floor tile from the above class. And I get an index out of range error. I hope that makes sense…

1 Like

Fixed it. I moved the declaration outside of the start() function of the class
private GameObjectConversionSettings settings;

Then I was able to add the following:

void OnDestroy() 
{
settings.BlobAssetStore.Dispose(); 
}

Problem solved.

3 Likes

Thanks! :slight_smile: