如何替换 Texture2D.Reinitialize()? Unity 2020.3没有这个功能
我将我的 Unity 项目更新到 Unity 2020.3.18 并收到此错误:
“Texture2D”不包含“重新初始化”的定义
根据文档,Texture2D 类突然没有函数 Reinitialize() https://docs.unity.cn/2020.3/Documentation/ScriptReference/Texture2D.html
所以如果没有这个函数,我假设我将不得不使用构造函数来代替?
旧代码:
Texture2D tex;
int newWidth;
int newHeight;
//get newWidth & newHeight
tex.Reinitialize(newWidth, newHeight);
新代码:替换 tex.Reinitialize(newWidth, newHeight);有了这个
tex = new Texture2D(newWidth, newHeight, tex.format, false);