Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Is Entity.Graphics supposed to work with URP's 2D Renderer at all?

Discussion in 'Graphics for ECS' started by Nith666, Apr 24, 2023.

  1. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    When setting up a scene with a Sub Scene that contains any of the 3D primitives with a Mesh Renderer and a 2D Renderer is installed as default, I get a lot of exceptions and the entities are not working. I think the root cause is that the render path of the 2D renderer can't be determined while checking if a "use the Forward+ renderer" warning needs to be shown. However, I wonder if this ever meant to be working as on one hand we're supposed to use the Forward+ renderer while at the same time orthographic projection is not supported which I believe is used in 2D games more often than perspective. Maybe someone from the Unity team can clarify the road ahead with 2D, URP and Entities.Graphics? Thanks!

    This problem occurs in Unity 2022.2.16 as well as in 2023.1.x with Entities.Graphics-1.00-pre65
     
  2. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    Hi,

    Entities Graphics only supports Forward+ in URP.

    2D Sprites / Tilemap etc. are only companion components which allows you to put them in subscene and query them in ECS system. That means they are still GameObjects i.e. won't benefit from the fast performance of Entities Graphics.

    Orthographic support in Forward+ will be available very soon.
     
    mahdi_jeddi likes this.
  3. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    Hi @mingwai Thanks for the info, that's good to know. For my game I've got kind of a hybrid of tiles and sprites as regular GameObjects combined with Quad based custom "sprites" as entities. I would use a regular Forward+ renderer (once orthographic is available), but I also want to have the 2D lights which seem to work only with a 2D renderer. So my initially described problem with the exceptions is a blocker. Is that issue known already?
     
  4. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    To clarify, do you mean you are using 2D Renderer for the Sprites and using Forward+ Renderer for the custom quad sprites (in this case your scene will have 2 cameras)?
    OR you want the custom quad sprites entities to be affected by the 2D lights from 2D Renderer?
     
  5. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    so far I had just one camera (and ideally would like to keep it that way) and everything, the tilesets as well as the custom quad sprites, have been rendered by the URP 2D Renderer. The 2D lights affect only the tiles and SpriteRenderers, which is fine. My problem is, that the use of a 2D Renderer in a scene that contains a subscene with Mesh Renderer GameObjects (e.g. a primitive cube or a quad) now causes exceptions and the entities are not being rendered anymore. This can easily be reproduced: Just use a blank URP project, create a 2D Renderer and set it as default. Create a sub scene in a scene and add a Cube to it. Then hit play and you will get a recurring exception
     
  6. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    Understand now, thanks for raising the issue. I've made a bug report to the Entities Graphics team.
     
    mahdi_jeddi and Nith666 like this.
  7. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    awesome, thanks!
     
  8. Buster9999

    Buster9999

    Joined:
    Jan 24, 2022
    Posts:
    1
    Is there a workaround for this? Or should we wait until the error is officially fixed?
     
    chemminger likes this.
  9. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    Hey, the bugfix will be available in the next 2022.2 patch release (2022.2.22f1).
     
    RoHofmann likes this.
  10. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    Awesome, thanks for letting us know!
     
  11. mingwai

    mingwai

    Small Graphics Potato Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    52
    Update: 2022.2.22f1 became 2022.3.0f1, which is available now.
     
  12. Nith666

    Nith666

    Joined:
    Aug 1, 2012
    Posts:
    57
    I can confirm that everything's working again now in Unity 2022.3 LTS! Awesome
     
    mingwai likes this.