如何从内容管理器卸载内容? [英] How do I unload content from the content manager?

查看:20
本文介绍了如何从内容管理器卸载内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 texture2d 上使用 dispose 函数,但这导致了问题,而且我很确定这不是我想要使用的.

I tried using the dispose function on a texture2d but that caused problems and I'm pretty sure it's not what I'm meant to use.

我应该使用什么来基本卸载内容?内容管理器是自己跟踪还是我需要做些什么?

What should I use to basically unload content? Does the content manager keep track itself or is there something I have to do?

推荐答案

看看我的回答 此处 可能还有此处一>.

Take a look at my answers here and possibly here.

ContentManager拥有"它加载的所有内容并负责卸载它.卸载 ContentManager 加载的内容的唯一方法是使用 ContentManager.Unload() (MSDN).

The ContentManager "owns" all the content that it loads and is responsible for unloading it. The only way you should unload content that a ContentManager has loaded is by using ContentManager.Unload() (MSDN).

如果您对 ContentManager 的这种默认行为不满意,可以按照 这篇博文.

If you are not happy with this default behaviour of ContentManager, you can replace it as described in this blog post.

您自己创建的任何纹理或其他可卸载资源都应该被处理掉(通过调用 Dispose())在您的 Game.UnloadContent 函数中.

Any textures or other unload-able resources that you create yourself without going through ContentManager should be disposed (by calling Dispose()) in your Game.UnloadContent function.

这篇关于如何从内容管理器卸载内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆