yasirkula / UnityIngameDebugConsole

A uGUI based console to see debug messages and execute commands during gameplay in Unity
MIT License
2.05k stars 218 forks source link

After running, output a NullReferenceException every second.Until focus game panel. #93

Closed ShenKang4181 closed 4 months ago

ShenKang4181 commented 4 months ago

image

my unity version : 2020.3.48 This is a detailed log NullReferenceException: Object reference not set to an instance of an object UnityEngine.UI.InputField.GenerateCaret (UnityEngine.UI.VertexHelper vbo, UnityEngine.Vector2 roundingOffset) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:2770) UnityEngine.UI.InputField.OnFillVBO (UnityEngine.Mesh vbo) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:2700) UnityEngine.UI.InputField.UpdateGeometry () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:2661) UnityEngine.UI.InputField.Rebuild (UnityEngine.UI.CanvasUpdate update) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:2613) UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/CanvasUpdateRegistry.cs:215) UnityEngine.Canvas:SendWillRenderCanvases()

yasirkula commented 4 months ago

I haven't encountered this issue before. When does this occur? PS. Oh wait, you said every second. If you do absolutely nothing after entering Play mode, this still occurs every second?

ShenKang4181 commented 4 months ago

Yes, it will happen every second until I click on the game panel. Do I need to provide anything else like log?

ShenKang4181 commented 4 months ago

This problem is new in version 1.6.7.

yasirkula commented 4 months ago

Not much has changed in 1.6.7 though. Are you sure this didn't happen on 1.6.6? BTW can I see your IngameDebugConsole's Inspector?

ShenKang4181 commented 4 months ago

yes,i sure this didn't happen on 1.6.6 image

yasirkula commented 4 months ago

If you put an unmodified IngameDebugConsole prefab to your scene and deactivate the modified one (for testing purposes), does the problem still occur for the completely unmodified prefab instance? If not, could you try to pinpoint exactly which modification causes this issue?

ShenKang4181 commented 4 months ago

i find this bug is image When I start running, I don't want UnityIngameDebugConsole to appear. When I need to debug, I will click a button (maybe f12) and open canvas.enable. Can you handle this problem?

ShenKang4181 commented 4 months ago

I was sure it would embarrass you, so I solved the problem myself.i add CanvasGroup to IngameDebugConsole and control alpha Thank you anyway.

yasirkula commented 4 months ago

I couldn't reproduce the issue on 2021.3.29f1 (just disabled Canvas, no other changes).

I'd recommend checking out the following settings because maybe you won't need to add a CanvasGroup at all: Start Minimized, Popup Visibility, Toggle Key

ShenKang4181 commented 4 months ago

oh! I have never seen this before, and now I have learned it.and I have an idea how to open it on a mobile device?

yasirkula commented 4 months ago

In my project, I've set Popup Visibility to "When Log Received" and changed log filter to only Error so that when an error is encountered, the popup is automatically shown. But you could also fully disable the popup and when you want to display the debug console (e.g. when 3 fingers are held at screen), call DebugLogManager.Instance.ShowLogWindow(); in your script.

ShenKang4181 commented 4 months ago

I get, thank you. ✌︎(ツ)ɔ