2016-02-26 23 views
0

,所以我想我的項目從Unity 4.6移動到統一5.3從單位4移動項目統一5 - 「這個名字someVar不會在當前的背景下存在」

我得到這個錯誤(通過標記//ERROR in 4 lines)腳本中的一些變量在當前上下文中不存在。

#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'。

有人遇到過這個在統一5,可以告訴我如何解決這個問題?

回答

1

使用的預處理指令#if ENABLE_4_6_FEATURES在這裏可能是錯誤的,因此這些變量不會被定義。嘗試評論預處理器。

//#if ENABLE_4_6_FEATURES 
    public GameObject userInterface; 
    public bool hideUIWhilePainting=true; 
    private bool isUIVisible=true; 
//#endif 
+0

你說,可能,我說肯定。你完全正確。 –

相關問題