XNA:Unload()的意义是什么? [英] XNA: What is the point of Unload()?

查看:88
本文介绍了XNA:Unload()的意义是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XNA游戏具有Unload()方法,其中应该卸载内容.但是,这有什么意义呢?如果要卸载所有内容,则必须退出游戏,在这种情况下,无论如何都将被垃圾回收,对吗?

XNA games have an Unload() method, where content is supposed to be unloaded. But what is the point of this? If all the content is being unloaded, then the game must be exiting, in which case everything would be garbage collected anyway, right?

推荐答案

据我所知,它对任何标准用途都没有用,因为正如您所说的,垃圾收集器可以为您处理事务.

As far as I understand it, it's not useful for any standard uses, since as you say the garbage collector deals with things for you.

但是,当您的游戏因许多原因退出时,有一个事件被称为很有用.例如,您可以向多人游戏中的所有客户端发送一条消息,告诉他们您要退出,然后让垃圾收集器终止您的网络连接.

However, it's useful to have an event called when your game is exiting for many things. For example you could send a message to all clients in a multiplayer game telling them you're exiting, and then you can let the garbage collector kill your network connections.

这篇关于XNA:Unload()的意义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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