I'm making a game in C# and XNA 4.0 and I want to use a texture to show players a screenshot of each level in the level select menu.
Since I'm only using one texture, I need to load a new one every time that the player highlights a new option on the menu. I do so with code similar to the following:
Texture2D levelTexture;
if(user.HighlightsNewOption)
{
//Notice that there is no form of unloading in this if statement
string file = levelSelectMenu.OptionNumber.ToString();
levelTexture = Content.Load<Texture2D>(file);
}
However, I fear that this current setup will cause memory usage issues. Would this problem be solved by unloading the texture first and then loading the new one? If so, how can I do this?