2017-08-31 78 views
0

我試圖修改Unity AR Core SDK中的演示場景並且 我創建了一個靜態bool變量isCreated來檢查Andy預製被建造。如何設置靜態變量並僅實例化AR Core演示的一個預製

在下面檢查

if (Session.Raycast(m_firstPersonCamera.ScreenPointToRay(touch.position), raycastFilter, outHit)) 

我設置的變量是真實的,然後把另一張支票這裏

if (Input.touchCount < 1 || (touch = Input.GetTouch (0)).phase != TouchPhase.Began || isCreated) { 
    return; 
} 

但由於某些原因,該變量爲永遠不會被設置爲真。 我也注意到了日誌中的this error,並且忍不住想知道它是否阻止了它被設置。

08-29 14:11:40.564 13392-13407/? E/Unity: OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
(Filename: ./Runtime/GfxDevice/opengles/GfxDeviceGLES.cpp Line: 368)

請幫忙。

回答

0

我不知道你是多麼想你的布爾靜態的,但我做類似的東西達到同樣的效果:

bool m_placed = false; // under the color array 

然後你一樣,我檢查它在這裏:

if (Session.Raycast(m_firstPersonCamera.ScreenPointToRay(touch.position), raycastFilter, out hit) && !m_placed) { 
    ... 
    m_placed = true; // At the very end of this block 
} 

這對我來說非常合適。我沒有已添加任何

if (Session.Raycast(m_firstPersonCamera.ScreenPointToRay(touch.position), raycastFilter, outHit)) 

OpenGL的錯誤是,已經提出了一個常見的問題。它不應該影響這一點。

https://github.com/google-ar/arcore-unity-sdk/issues/3

相關問題