将项目从统一 4 移动到统一 5 - "The name someVar does not exist in the current context"
Moving project from unity 4 to unity 5 - "The name someVar does not exist in the current context"
所以我正在尝试将我的项目从 unity 4.6 转移到 unity 5.3
我收到此错误(标记为 4 行中的 //ERROR)脚本中的某些变量在当前上下文中不存在。
#if ENABLE_4_6_FEATURES
using UnityEngine.EventSystems;
#endif
public class MobilePaint : MonoBehaviour {
...
#if ENABLE_4_6_FEATURES
public GameObject userInterface;
public bool hideUIWhilePainting=true;
private bool isUIVisible=true;
#endif
...
public void HideUI()
{
if (!useNewUI) return;
isUIVisible=false;//ERROR
userInterface.SetActive(isUIVisible);//ERROR
}
public void ShowUI()
{
if (!useNewUI) return;
isUIVisible=true;//ERROR
userInterface.SetActive(isUIVisible);//ERROR
}
'isUIVisible' 和 'userInterface' 的错误。
有人在 unity 5 中遇到过这个问题,可以告诉我如何解决这个问题吗?
使用的预处理器指令 #if ENABLE_4_6_FEATURES 在这里可能是错误的,因此不会定义这些变量。尝试注释掉预处理器。
//#if ENABLE_4_6_FEATURES
public GameObject userInterface;
public bool hideUIWhilePainting=true;
private bool isUIVisible=true;
//#endif
所以我正在尝试将我的项目从 unity 4.6 转移到 unity 5.3
我收到此错误(标记为 4 行中的 //ERROR)脚本中的某些变量在当前上下文中不存在。
#if ENABLE_4_6_FEATURES
using UnityEngine.EventSystems;
#endif
public class MobilePaint : MonoBehaviour {
...
#if ENABLE_4_6_FEATURES
public GameObject userInterface;
public bool hideUIWhilePainting=true;
private bool isUIVisible=true;
#endif
...
public void HideUI()
{
if (!useNewUI) return;
isUIVisible=false;//ERROR
userInterface.SetActive(isUIVisible);//ERROR
}
public void ShowUI()
{
if (!useNewUI) return;
isUIVisible=true;//ERROR
userInterface.SetActive(isUIVisible);//ERROR
}
'isUIVisible' 和 'userInterface' 的错误。
有人在 unity 5 中遇到过这个问题,可以告诉我如何解决这个问题吗?
使用的预处理器指令 #if ENABLE_4_6_FEATURES 在这里可能是错误的,因此不会定义这些变量。尝试注释掉预处理器。
//#if ENABLE_4_6_FEATURES
public GameObject userInterface;
public bool hideUIWhilePainting=true;
private bool isUIVisible=true;
//#endif