Hi there, I found a NullReferenceException in Unity:
NullReferenceException: Object reference not set to an instance of an object Convai.Scripts.Runtime.UI.ChatUIBase.DeactivateUI () (at Assets/Convai/Scripts/Runtime/UI/Chat/ChatUIBase.cs:60)
I could fix it by using ‘?’: UIStatusChange?.Invoke(false);
That is also used in line 50. So I assume that is the correct fix?!
Thanks Rainer
Hi @K3 ,
I have an “edit” / Admin mode in my app, where I want to hide the convai UI. I use this code and then it happens when I want to deactivate the UI:
public void SetState(bool state)
{
_convaiInputManager.enabled = state;
_convaiUI.SetActive(state);
if (ConvaiChatUIHandler.Instance == null)
{
Debug.LogWarning("ConvaiChatUIHandler component not found!");
return;
}
// Hide the ConvaiChatUIHandler currentUI
IChatUI iChatUI = ConvaiChatUIHandler.Instance.GetCurrentUI();
if (iChatUI != null)
{
if (state)
{
iChatUI.ActivateUI();
}
else
{
iChatUI.DeactivateUI();
}
}
else
{
Debug.LogWarning("IChatUI component not found!");
}
}
Hi,
I´m not sure why you would need that. My post is just about a bug I found. I thinks it’s save to use my fix in my project and you should apply the fix to the codebase in general.
I sent this info via email before. I got an answer that I should post it here. Please forward it to a developer. They will know if / what to apply.
Some background: I want to position colliders in the room. Therefore I have an admin mode where I can place Spatial Anchors (meta Quest 3 is used). In this mode I disable convai and the convai UI. Therefore I created the function posted in my last reply.
Hi,
no I didn’t do anything to the logo or so. I just found this functionality to hdie the current UI prefab which is visible by getting it with IChatUI iChatUI = ConvaiChatUIHandler.Instance.GetCurrentUI();
and then hiding the complete UI prefab / gameobject with iChatUI.DeactivateUI();
Cheers
Rainer