Search Unity

Question Sprites are not drawn in URP 2D via Graphics

Discussion in '2D' started by Paulsams, May 28, 2022.

  1. Paulsams

    Paulsams

    Joined:
    Feb 14, 2020
    Posts:
    6
    Hello everyone. I have a problem in that I want to draw URP 2D/Lit sprites in my bullet hell game using a low level in order to abandon GO completely for bullets only.

    I will immediately make a reservation that I do not want to use DOTS, since I want to make my own Data-oriented design, which I have already done in principle. And yes, I tried to rewrite to ECS from Unity, but the difference turned out to be zero (although I did not use Hybrid Renderer, but it would definitely be faster with it). And the reason why ECS from Unity equaled my decision was that I had to take components from ordinary code, which ate up a good amount of time.
    Returning to the question, maybe someone has ideas to draw sprites through instancing? Because Graphics.DrawMeshInstanced wants to draw only URP/Unlit and nothing else. And with Graphics.DrawMesh, even taking into account the rejection of GO, works slower. Even with URP/Sprite Unlit doesn't want to. I tried to figure out how sprites are drawn in 2D URP, but I only realized that meshes are collected, I believe, at the stage of SRP work and I did not find how to add more meshes there. I also tried to figure out how Hybrid Renderer works, but going through the scripts I didn't find anything interesting for me. I also saw BRG, but I understood that it is very unlikely to work with 2D URP due to the fact that there is no DOTS_INSTANCING_ON keyword.

    In general, if someone knows how to draw Lit sprites or add them to the rendering pass, then I will be immensely grateful.