恶性漏洞通知&解决方案_关于Unity官方插件的兼容性问题
开发者常用Unity的一个标准资源包:Standard Assets但是最近在Unity2019.3.0a及后续版本中出现了因为弃用方法造成的恶性兼容性漏洞
我们先导入一下包
然后就报错了
控制台给出的错误是
Assets\Standard Assets\Utility\ForcedReset.cs(6,27): error CS0619: 'GUITexture' is obsolete: 'GUITexture has been removed. Use UI.Image instead.'看来问题出现在Standard Assets调用了弃用的GUITexture
找到脚本修改一下
按照我的方式修改SimpleActivatorMenu脚本
using System;
using UnityEngine;
using UnityEngine.UI; //在此处添加
namespace UnityStandardAssets.Utility
{
public class SimpleActivatorMenu : MonoBehaviour
{
// An incredibly simple menu which, when given references
// to gameobjects in the scene
public Text camSwitchButton; //在此处修改
public GameObject[] objects;
......除此之外还需要修改ForcedReset脚本
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityStandardAssets.CrossPlatformInput;
using UnityEngine.UI; //在此处添加
//在此处修改
public class ForcedReset : MonoBehaviour
{
private void Update()
{
// if we have forced a reset ...
if (CrossPlatformInputManager.GetButtonDown("ResetObject"))
{
//... reload the scene
SceneManager.LoadScene(SceneManager.GetSceneAt(0).name);
<span class="p">}
}
}完成!
页:
[1]