Unity IRtcEngine 回調沒有反應

以下是我的Unity 腳本
Log(mRtcEngine.JoinChannel(channel, null, 0)) 為 0 但是 沒有幫我回調 OnJoinChannelSuccess
是我程式有寫錯嗎?

public class AgoraVideo : MonoBehaviour{
	private string appID = "AppID";
	private string channel = "MyChannel";
	private IRtcEngine mRtcEngine;
    private uint myUID = 0;

    void Start(){
    	if (mRtcEngine != null)
            IRtcEngine.Destroy();

        mRtcEngine = IRtcEngine.GetEngine(appID);
        mRtcEngine.OnJoinChannelSuccess = OnJoinChannelSuccess;

        // Your video feed will not render if EnableVideo() isn't called. 
        mRtcEngine.EnableVideo();
        mRtcEngine.EnableVideoObserver();

       // By setting our UID to "0" the Agora Engine creates a new one and assigns it. 
       mRtcEngine.JoinChannel(channel, null, 0);
       Debug.Log(mRtcEngine.JoinChannel(channel, null, 0));		//retrun 0
    }
    // this not working 
    private void OnJoinChannelSuccess(string channelName, uint uid, int elapsed)
    {
        Debug.Log("A");
        myUID = uid;
    }
    //略...
}

可能是uid设为0导致的,uid为0则系统会自动分配uid,所以你的回调收不到消息因为uid不匹配,把join时uid改成1以上的数试一下

對不起我不太懂意思,我剛剛有嘗試過跟改為mRtcEngine.JoinChannel(channel, null,500 ),他還是沒有進去OnJoinChannelSuccess,但是我想要讓他自動分配Uid可以這樣嗎?

可以参考一下这个文档中的设置方法和demo参考一下:https://docs.agora.io/cn/Video/start_call_unity?platform=Unity#3-初始化-irtcengine

謝謝那我在研究一下,因為在上週做的時候沒問題,都可以運作,沒想到今天就出現這個問題,謝謝你