如果出现问题,是否可以恢复 GraphicsDevice? [英] Is it possible to restore a GraphicsDevice if something goes wrong with it?

查看:25
本文介绍了如果出现问题,是否可以恢复 GraphicsDevice?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个讨厌的问题我的游戏在更改游戏窗口大小时随机崩溃,我似乎无法找到问题的根源,所以我想尝试从另一个角度解决这个问题.

I'm having this nasty problem with my game randomly crashing when changing the game window size, and I can't seem to find the source of the issue, so I'd like to try and approach this from another angle.

假设 GraphicsDevice 以某种方式被处理了.我可以重新创建它或将其恢复到工作状态,以便游戏可以继续运行吗?

Say the GraphicsDevice got disposed somehow. Can I recreate it or return it to its working state, so the game could continue running?

推荐答案

没有.

该实例与许多事物相关联,以至于在其生命周期中处理掉该实例之后使用新实例实际上是在重新实现 XNA.如果您尝试使用它并且它已被处理掉,那么您就做错了.并且您无法通过修复一个带有巨大设计和项目错误的小实施错误来使事情正确.

That instance is coupled to so many things, that using a new one after that's been disposed in its life cycle would be pratically reimplementing XNA. If you're trying to use it and it's been disposed, you're doing something very wrong. And you can't make things right by fixing a small implementation error with a huge design and project error.

为了你自己的利益,试着找出你做错了什么,然后改正.检查您所做的一切是否在正确的时间完成.

For your own good, try to figure out what you've done wrong, and fix that instead. Check whether everything you're doing is being done at the right moment.

这篇关于如果出现问题,是否可以恢复 GraphicsDevice?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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