Getting NullReferenceException When Building to Android and Using Immediate Mode Drawing
Whenever I load a scene where I am doing Immediate Mode Drawing after building to Android, using
using (Draw.Command(cam))
I get the following runtime error (I have Compatibility Mode disabled.):
2024/12/11 21:31:22.985 24901 25004 Error Unity NullReferenceException: Object reference not set to an instance of an object. 2024/12/11 21:31:22.985 24901 25004 Error Unity at UnityEngine.Rendering.RenderGraphModule.RenderGraphResourceRegistry.GetRenderTargetInfo (UnityEngine.Rendering.RenderGraphModule.ResourceHandle& res, UnityEngine.Rendering.RenderGraphModule.RenderTargetInfo& outInfo) [0x00000] in <00000000000000000000000000000000>:0 2024/12/11 21:31:22.985 24901 25004 Error Unity at UnityEngine.Rendering.RenderGraphModule.RenderGraphBuilders.CheckUseFragment (UnityEngine.Rendering.RenderGraphModule.TextureHandle tex, System.Boolean isDepth) [0x00000] in <00000000000000000000000000000000>:0 2024/12/11 21:31:22.985 24901 25004 Error Unity at UnityEngine.Rendering.RenderGraphModule.RenderGraphBuilders.SetRenderAttachment (UnityEngine.Rendering.RenderGraphModule.TextureHandle tex, System.Int32 index, UnityEngine.Rendering.RenderGraphModule.AccessFlags flags, System.Int32 mipLevel, System.Int32 depthSlice) [0x00000] in <00000000000000000000000000000000>:0 2024/12/11 21:31:22.985 24901 25004 Error Unity at Shapes.ShapesRenderPass.RecordRenderGraph (UnityEngine.Rendering.RenderGraphModule.RenderGraph renderGraph, UnityEngine.Renderi
If I disable the script that is using immediate mode drawing, the errors disappear.
sorry for taking so long to get to this, I'm looking into it at the moment! thanks a ton for sharing your solutions it helps get fixes through much faster
Thanks Freya. Let me know if you need help testing. I really need this working on the Meta Quest platform.