2014-10-11 2 views
1

나는 그것이 어리 석다는 것을 확신하지만, 알아낼 수는 없다. 다음 코드 Unity Error CS0126

public GameObject AISelectCannon() { 
    Debug.Log("AISelectCannon called"); 
    GameObject desiredCannon = AIController.selectCannon(0); 
    if (desiredCannon.tag.Contains("Cannon")) return; 
    m_SelectedCannon = desiredCannon; 
    aiSelectionPending = true; 
    return m_SelectedCannon; 
} 

다음 오류 던지고 :

Scripts/CubeContainer.cs(61,59): error CS0126: An object of a type convertible to `UnityEngine.GameObject' is required for the return statement 

는 AIController에서

다른 관련 정보 (게임 오브젝트 desiredCannon는 .... 라인 61이다)

public static GameObject selectCannon(int side) { 

그래, 어떤 아이디어?

+1

반환 첫 번째 반환 문 밤은 말한다 귀하는 IT가 게임 오브젝트 – JRowan

+0

가 null을 반환하도록 변경 복귀 밤은, 경우. 결정된. > _ < – Blab

답변

0

아무것도 반환, 그냥 난 후 그 첫 번째 return 문을 생각

if (desiredCannon.tag.Contains("Cannon")) return // return something