Skip to content

Allow long unused textures to be unloaded#1671

Merged
Interkarma merged 1 commit intoInterkarma:masterfrom
rossipaolo:texture-cache
Feb 2, 2020
Merged

Allow long unused textures to be unloaded#1671
Interkarma merged 1 commit intoInterkarma:masterfrom
rossipaolo:texture-cache

Conversation

@rossipaolo
Copy link
Copy Markdown
Collaborator

Added experimental setting "AssetCacheThreshold". If different than zero, this is the time in minutes from last access for which a texture can be stored in cache. During fast travels textures that exceed this value are removed to allow Unity to unload them if unused.

@rossipaolo rossipaolo added the enhancement A new feature or an improvement to an existing one. label Jan 20, 2020
@rossipaolo rossipaolo requested a review from Interkarma January 20, 2020 21:49
Comment thread Assets/Scripts/MaterialReader.cs Outdated
float threshold = AssetCacheThreshold * 60;
foreach (var item in materialDict.Where(x => time - x.Value.timeStamp > threshold).ToList())
materialDict.Remove(item.Key);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some log, say "x materials expired"?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this would be valuable information, the log is already a bit "spammy" at times...

Comment thread Assets/Scripts/MaterialReader.cs
Added experimental setting "AssetCacheThreshold". If different than zero, this is the time in minutes from last access for which a texture can be stored in cache. During fast travels textures that exceed this value are removed to allow Unity to unload them if unused.
@Interkarma
Copy link
Copy Markdown
Owner

I'm happy with this. Thank you. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A new feature or an improvement to an existing one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants