Hi devs, a newbie need pieces of advice on the topics :
Here is the context : I'm trying to build a custom drawing gizmos system for ecs using burst and jobs.
To display the "lines" or "shapes" (meshes) I chose to use Graphics.RenderMeshIndirect in addition with a custom URP Shadergraph Shader for GPU Instancing, easy to use, fast to render for debugging purposes.
I have to feed Graphics.RenderMeshIndirect with a ComputeShader of custom draw data (position, length, width, color...) among others parameters.
Here is the expected project : I want to have the ability to call a static method (ex : Gizmos.DrawLine(DrawData data)) in any (Bursted) System like Debug.DrawLine(). This method would feed (.add) a temp NativeList<> store in the static class Gizmo. I don't know if this approach is good enough but it actually works for my project.
Here is the question : Now the problem is (bursted) jobs, I don't really know how to deal with concurrent writing. My idea is to build a custom container like an ECB with Draw() equivalent methods to pass to the job and when it is completed, use an .addRange equivalent to feed the main NativeList stored in the static class Gizmos, but right now I'm struggling with race conditions and job dependency issues.
I would be grateful to hear your thoughts on the project, potential solutions and critics, thanks in advance