Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feature Request 2D Support in DOTs?

Discussion in 'Entity Component System' started by LieblingsMartini, Nov 16, 2022.

  1. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Hello everyone,
    I had high hopes of being able to implement my 2D game in DOTS. Now I've noticed that 2D is not being pursued any further.
    I don't really understand why this very important part of Unity gets too little attention.
    I would like to know if it could still be supported for version 1.0 or if I need a completely different approach now.

    I would appreciate an answer because it also depends on the further future of my game.

    Thanks in advance.
     
  2. kdchabuk

    kdchabuk

    Joined:
    Feb 7, 2019
    Posts:
    47
  3. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Thanks for your answer.
    Apart from the physics, no real rendering of sprites works either.
    I'm wondering if it's worth waiting or if I have to go a completely different route.

    Is there an official statement on this?
     
  4. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    334
    Right at this moment I'm developing sprite rendering solution for dots. The main part done, but some features like layering aren't there yet. Also solution currently only supports Entities 0.51.1 and have no example project, but currently I'm working on it (basic documentation exists though). You can search similar solutions here on forum, which might be even more suitable for you, but I was targeting maximum flexibility while developing.

    There is old thread which might be helpful also and provide another rendering solution.
     
    Last edited: Nov 17, 2022
    soargon and ThatDan123 like this.
  5. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Thank you for the information. I'll take a closer look.
    Maybe there will be an official statement for the future at some point.
     
  6. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    334
    There was project Tiny some time ago which had 2D rendering support, but Tiny was separate from main DOTS dev and then it was gone.
     
    LieblingsMartini likes this.
  7. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,877
    Render as quads for now, its not great but its something. Back in the day before unity supported sprites, everything was quads and people managed, I am sure you will get by until official support arrives ;)

    Good luck!
     
    LieblingsMartini likes this.
  8. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Thanks for the further advice. I will also test this once.
     
  9. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    289
    I too have similar concerns about 2D in DOTS. Next week I will work on a prototype but everything is still quite confusing.
     
  10. jGate99

    jGate99

    Joined:
    Oct 22, 2013
    Posts:
    1,845
    Sorry for asking a noobish Question,
    Are you saying that Using 3D URP, we cant use "sprites" in expermintal 1.0?
     
  11. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Exactly. The sprites are not rendered correctly. Without proper 2D graphics and physics support, DOTs doesn't do much for me. I'm already reaching my limits in my project. Hopefully it's being worked on.
     
  12. jennal

    jennal

    Joined:
    Oct 28, 2017
    Posts:
    24
    Great job, is this project compatible with mobile?
     
  13. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    334
    Since you can use whatever shader and render pipeline compatible with GPU instancing - yes while mobile supporting those things. But there is a big question how DOTS and IL2CPP works with your target devices and unfortunately there is a bug in 0.51.x and maybe still on 1.0.x which described in this thread, so I can't even test it on mobile platform, because can't build (using subscene isn't necessary for my system, but whole project uses subscene, so it will take a time to switch to regular scene approach).
     
  14. MaNaRz

    MaNaRz

    Joined:
    Aug 24, 2017
    Posts:
    117
    How are sprites not rendering correctly? I use a hybrid workflow without too many issues. For animated sprites i spawn GameObjects as representation of my simulation Entities to be able to use the 2DAnimation Package and for static ones or moving ones without animation (like some of my projectiles) just placing entities into the scene works fine. Physics wise i just use the 3D physics in a 2D world (though my game is 2.5D)
     
  15. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Sorry I was only referring to the Sprite Renderer component.
    I have no experience in 3D, but if I can do all the 2D functions there, I should switch there.
    Anyway, thanks for all the tips. I'm excited to see what I can achieve with it.
     
  16. jennal

    jennal

    Joined:
    Oct 28, 2017
    Posts:
    24
    I am working on 2D game with entities, too. SpriteRenderer is working fine with entities. Put the SpriteRenderer on gameObject in your sub scene, and it will automaticially become a Component, and do its render job. But I think the further problem is how to do animation? Because animator is ignored for now. I don't know there is an official way to play animation clip for now.
     
    quieye likes this.
  17. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    334
    In 0.17 entities all happens is for particular components implemented conversion system which just do
    GameObjectConversionSystem.AddHybridComponent(Component /*monobehaviour here*/)
    . After that mono exists on specially created gameobject for converting entity with this component. You can do the same thing with any component you want and then deal with it through regular Entities syntax (without any burst and threading of course). I don't know is it workable solution for 0.51.x and 1.0+. In 1.0+ conversion was reworked and named "Baking", I've not seen it yet, so can't comment.
     
  18. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    I have now created a 3D project with DOTs (2022.2.0b15)
    Then I created a subscene with two different game objects. One has the sprite renderer component, the other is a quad with mesh renderer.
    I provided both with a sprite.
    Here's what happens when I change the position at runtime:
    First of all, the position is rendered correctly. But as soon as I interact with the editor, the object jumps to the starting position with the Sprite Renderer component and no longer renders the new position. The quad, on the other hand, seems to continue to work.

    For a hybrid approach, I wanted to install the 2D animation package, but I also get an error message there.
     
  19. MaNaRz

    MaNaRz

    Joined:
    Aug 24, 2017
    Posts:
    117
    Editing Authoring Data at runtime is not really ready yet. Make sure you have SubScenes closed if you see weird behaviour.

    Yes the new Collections Package is not yet compatible with the 2DAnimation package. I had to modify the 2DAnimation Package to make it work (it was like 3 really small changes). I reported this to Unity already to make sure the next 2DAnimation Package version is compatible.
     
    ildarshara and LieblingsMartini like this.
  20. LieblingsMartini

    LieblingsMartini

    Joined:
    Oct 16, 2021
    Posts:
    21
    Thanks for the feedback.
    Then I will continue to work in this area and gain experience.