The default configuration is for the asset database to automatically unload an asset when it's no longer referenced. This causes problems when we would delete objects and then go to make more instances that reference the same asset while the same mission is going.

So autounload is disabled to prevent excessive unloading of assets before the level is concluded.
This commit is contained in:
Areloch 2016-06-06 21:20:00 -05:00
parent 3a73344abb
commit 0ec9438429
4 changed files with 8 additions and 5 deletions

View file

@ -100,8 +100,6 @@ mAcquireReferenceCount(0),
mpOwningAssetManager(NULL),
mAssetInitialized(false)
{
// Generate an asset definition.
mpAssetDefinition = new AssetDefinition();
}
//-----------------------------------------------------------------------------
@ -154,4 +152,8 @@ void ShapeAsset::copyTo(SimObject* object)
{
// Call to parent.
Parent::copyTo(object);
}
void ShapeAsset::onAssetRefresh(void)
{
}

View file

@ -79,7 +79,7 @@ public:
Resource<TSShape> getShapeResource() { return mShape; }
protected:
virtual void onAssetRefresh(void) {}
virtual void onAssetRefresh(void);
};
DefineConsoleType(TypeShapeAssetPtr, ShapeAsset)

View file

@ -167,7 +167,8 @@ bool MeshComponent::setMeshAsset(const char* assetName)
{
// Fetch the asset Id.
mMeshAssetId = StringTable->insert(assetName);
mMeshAsset.setAssetId(mMeshAssetId);
mMeshAsset = mMeshAssetId;
if (mMeshAsset.isNull())
{

View file

@ -76,7 +76,7 @@ AssetManager::AssetManager() :
mMaxLoadedPrivateAssetsCount( 0 ),
mAcquiredReferenceCount( 0 ),
mEchoInfo( false ),
mIgnoreAutoUnload( false )
mIgnoreAutoUnload( true )
{
}