This code is invoked by delegate:
private void OnMsgBoxClick(object arg)
{
if (arg.GetType() == typeof(int))
{
this.LogWarning("OnMsgBoxClick() arg: {0}", arg.ToString());
}
}
and it gives NullReferenceException, but still debug this sentence after like this:
NullReferenceException: Object reference not set to an instance of an object
> 21:29:11.777 Example_MsgBox::Invoke() OnMsgBoxClick() arg: 0
and I want to get the debuger without error. How can I deal with this question?
This is my Error Call Stack.
NullReferenceException: Object reference not set to an instance of an object
Example_MsgBox.OnMsgBoxClick (System.Object arg) (at Assets/GamePlay/Example/Example_MsgBox.cs:28)
GamePlay.UI.UIAPI+<ShowMsgBox>c__AnonStorey0.<>m__0 (System.Object closeArg) (at Assets/GamePlay/UI/UIAPI.cs:32)
SGF.UI.FrameWork.UIWindow.OnDisable () (at Assets/SGF/UI/FrameWork/UIWindow.cs:73)
UnityEngine.GameObject:SetActive(Boolean)
SGF.UI.FrameWork.UIWindow:Close(Object) (at Assets/SGF/UI/FrameWork/UIWindow.cs:119)
GamePlay.UI.Common.UIMsgBox:OnBtnClick(Int32) (at Assets/GamePlay/UI/Common/UIMsgBox.cs:62)
UnityEngine.EventSystems.EventSystem:Update()
This is 'UIMsgBox':
public void OnBtnClick(int btnIndex)
{
if (btnIndex.GetType() == typeof(int))
{
this.Close(btnIndex);
}
}
This is 'UIWindow':
public delegate void CloseEvent(object arg = null);
public event CloseEvent OnCloseEvent;
public sealed override void Close(object arg = null)
{
this.Log("Close() arg:{0}", arg);
if (this.gameObject.activeSelf)
{
this.gameObject.SetActive(false);
}
OnClose(arg);
if (OnCloseEvent != null)
{
OnCloseEvent(arg);
OnCloseEvent = null;
}
}
Sorry, I think it's too long.
Thanks!!!