What's stopping you from completing your 2D games in Unity?

I was actually going to show off some of the stuff I mentioned in the past and bring up somethings @AlexVillalba has brought up in the past. Also pinging him for his feedback due to him sharing a lot of ideas for 2D Rendering and TileMap improvements.

I will split the videos into smaller sections to help be able to isolate different topics and areas of 2D.
Just might take a couple days to document, record, and make the files for examples.

1 Like

Not only a 2D problem, but the lack of separation of concerns when it comes to layers is cumbersome. Layers are both used for rendering and for physics. Yes, there are render layers which are a step in the right direction, but lots of URP features and the Camera don’t utilise them. I still have to use up some of my precious 32 layers for purely rendering purposes, which feels very odd and is a pain to maintain.

1 Like

That and having too many render layers can start to affect performance.

Wondering if there should be something like this or if it might be too much.

Tile layers. The default tile settings for when a tile is painted on to a tile map to help centralize simple set up of tiles that need to be on layers with colliders and certain sorting layers. This lets you set the collision layer of the tile map by default and the default sorting layer if you want. This being an optional thing to use.

Example of this you could have a new asset type called Tile Map Definition or something along those lines. This would be a simple way to set up an entire Tile Map root object and auto add the child tile map layers. Each tile asset could have an optional Tile Layer option that allows it to by default auto be painted on to the correct tile layer. This could help lower the amount of set up time for creating new tile map scenes, lower the time needed to switch back and forth between the correct tile layer to paint tiles by auto selecting the correct tile layer the tile needs to be painted on, or if the tile layer it needs to be painted on doesn’t exist in the scene auto add it to the current tile map object grid.

Imagine you have an auto tile that is for an interior castle that acts as the floor, roof, and walls that the player can platform on. You could set the Tile Layer options to be on the user defined platform physics layer, the midground sorting layer, and then when you try to paint that tile in a scene it auto selects the platform tile map with the midground sorting layer. No need for manual switching between the correct tile layers and realizing you are painting on the right layer. Due note this should be optional and have some sort of API to override it during run time or in editor for custom tiles.

Render layers to control the lighting, shadows, shader effects, post processing, and VFX particles.
Think masks, blend lights, water reflections, and so forth.

Sorting layers can stay the same since they do what you think they are supposed to do right now.

For physics layers this should have nothing to do with any layering or rendering options at all.

I have a problem where the text object doesn’t display the score when I go to another scene and come back to this scene in 2d.

Just ran into the issue of sprite masks not supporting soft/feathered/gradient masks, etc, which has been an issue for over a decade. So, maybe it’s about time that is fixed. Makes what I need to do in this particular situation dramatically more complicated.

That’s just a general code/project bug. You should really make your own thread about this.

1 Like

As above, this isn’t a general support thread and text is UI, not a 2D feature. Please use your own thread for support.

Thanks.

Hi @Jonathan-Westfall-8Bits , I’m not sure about what should I do here but I can share some links to posts I wrote years ago, asking for very basic things.

Rendering
In this thread I collect all the modifications I had to do to the 2D Renderer in order to achieve some visual effects and optimizations. In summary:

  • Multiple render targets
  • Emissive colors + Bloom affecting emissive colors only
  • Configurable alpha blending
  • Lights with “volume”
  • BIG optimization of shadow calculations
  • Shadow softening
  • Per-camera post-processing
  • Custom sprite pivot in Sprite Light2Ds
  • Light texture caching (BIG optimization)

Tilemap Shadowcaster

An alternative design for Tilemap edition windows
Introducing the concept of “tilemap layers”. It allows drawing on a specific layer automatically by selecting a tile from the palette, for example.

2D NavMesh
Unity lacks from tools to help creating AI-related stuff, specially in 2D.

Target sorting layers as assets
Storing a reference to an asset that specifies the sorting layers affected by a light, instead of ticking the flags in the light component or the shadow caster component.

Animation editor QoL improvements
Apart from what I explain in the thread, I would also add that everything that surrounds Flipbooks, including their integration in the Animation window, need a lot of work to make it more handy, more integrated. It would be awesome if, for example, we could set indices of sprites from a spritesheet in the Animation window, instead of references to Sprites (but it still showed the resolved sprite in the timeline), so we could reuse the same animation clip with other GameObject that had a different spritesheet (that fulfilled some constraints like having the same amount of sprites).

2 Likes

These were actually some of the threads I was planning on sharing. I think a lot of your feedback is spot on for things that could improve 2D games. The Target Sorting Layers as asset and the Tile Map Editor are a couple big ones.

I saw you talk about the Sorting layer asset idea you worked on, and I ended up making my own system from scratch for Tile Assets. It really sped up development time when working on bigger scenes.

Some of these things could easily remove dozens of hours a month for 2D game projects and lower headaches.

1 Like

I have a question should we add 2D URP topics here as well. Wasn’t sure if there was a 2D dedicated URP graphics developer or if it be preferred to go ahead and share more stuff like that here.

This also brings me to the question should we bring up stuff related to other team packages.
I noticed some of the requests here are geared more to the animation, cinemachine, and a couple other packages. Want to check what we consider to be on topic for 2D development. Is it anything that can be a blocker for 2D projects, anything related to the 2D team side of things, or things that belong to other teams, but can have extensions or helper code added to it from the 2D team?

Example of the last statement is 2D confiners for cinemachine. They are related to 2D, but for the purpose of this topic does the Unity devs want us to consider that a Cinemachine related question instead of 2D question? Think having a clear definition of what realistic things we can ask the 2D team would help speed up the feedback process.

For context, the two things I want to bring up involves stuff like the following for URP.

VFX Graph improvements related to 2D collisions. This was actually a blocker on using the VFX Graph in a commercial project completely due to the environmental interactions we were wanting to do with it.

2D Water Rendering - This doesn’t need any type of physics and can be simple at the start like a standard asset shader. Think just basic refraction, reflection that doesn’t need extra cameras in the scene or too many extra cameras, and wave tops. No need for foam, exit/enter particles, and so forth.

I find the Spriteshape package to be a huge time saver when building out set decoration in 2D, however I’ve run into a number of limitations that make it difficult or impossible to create a desired effect.

For example:

  • Being able to offset corners or caps, while keeping the collider matching the Spline.
  • Better access to the underlying Spline, in a way that allows for easily calculating tangents or normals at a point in the spline (t). Ideally using an API consistent with the Splines package.
  • Allowing for continuous (stretched) corners without having to add an actual 90 degree corner sprite, or at least programatic access to the SplineControlPoints to be able to modify this through script.
  • More/better examples of custom geometry creation (what can this be used for exactly?)
  • Inverting the Fill, so that the spriteshape is defining a ‘hole’ in the middle.

The 3rd party package Ferr2D supported a lot of these features, but is no longer maintained/performant/compatible.

Additionally I’d love to see a good solution for a 2D character controller (that uses 2D collisions). Something that supports moving and rotating platforms, as well as all the existing 2D affectors etc. Currently need to rely on custom solutions or 3rd party tools, and even then there aren’t great 2D examples. I’ve seen the new collide and slide functions added to Rigidbody2D and I think that is a great start. Something along the lines of the character controller shown in Gigaya, but for 2D.

Thanks for the community outreach!

Post One - Topic Sprite Editor Tools and API.

Going to start my long list of issues with Unity 2D tools. Trying to split these into smaller posts to help them be easier to go through. Starting off with the Sprite Editor.

Sprite Window Editor Functionality

Not being able to select multiple sprites at once and edit them. This is the biggest issue for a lot of people using Unity Sprite Editor. We want to be able to select multiple sprites and change their values at once. Imagine you have thousands of Sprites like our project, going through and renaming each frame in a sprite sheet can be painful. It literally can take hours from scratch to name frames of character sheets to set up for animations. We also need some stuff tweaked for pivot point on certain sets of frames for things like crouching, crawling and so forth if we want to keep certain sized cells consist in the project.

Multi Sprite Renaming

I would like to see this functionality added and this is a simple change to be able to have the ability to select multiple sprites in the Sprite Editor and change their values. For renaming a set of sprites you can use the already in Editor option located in the Project Settings called Game Object Naming to let people choose how they are named. Example Player Bow 0, Player Bow 1, and so forth. Just please add a new option for the Game Object Naming that follows this convention Name 0. There is no option for name of the object with a space than adding just a digit.

This one change would speed up devs lives a lot and make it a lot simpler. It would also need the proper API calls to do it via custom editor as well if people are using Unity’s SpriteEditorModuleBase abstract class to add new Sprite Editor Modules.

Sprite Frame Module.cs API Usability

The next biggest issue with the Sprite Editor is honestly the use of internal marked API. A lot of the API is marked internal requiring reflecting to use or to copy it out and make your own files. The problem is there is so many interlocked files relying on each other it takes forever to do it.

I have gotten the multi selection Sprite working inside of Unity’s built in Sprite Editor implemented with proper renaming, but it was a huge headache from having to get the original sprite editors features working with just adding a couple extra features on top of it. It is a lot faster to make your own sprite editor from scratch even with there being half the API already made for you, because you can’t easily call most of the API. Some of the API should be safe to let user’s access.

Internally Marked Sprite Frame Module Classes and Enums

Example why is the SpriteRectModel class marked internal. Surely it would be nice to be able to use in custom editors. Some basic enums, that doesn’t make any sense for them to be internal, such as AutoSlicingMethod and PivotUnitMode should be pulled out of the classes and marked public.

Internal Helper Methods

There are a lot of helper classes that might not be able to be pulled out, but being able to call them would be nice like the DoAutomaticSlicing, GetGridRects, and DoGridSlicing methods located inside of the Sprite Frame Module. I mean just make some of the Sprite Frame Module.cs related classes not marked internal and that honestly solves a lot of the pain points of those wanting to work with the Sprite Editor. At that point people can easily implement their own stuff.

At the moment though if something doesn’t exist people have to make it from scratch when it doesn’t have to be. Most of the API is there, but we can’t take advantage of it. If we can access and use the API than we could implement on our stuff while waiting for the features to come to the editor by default more easily.

For anyone wondering how big of an issue this API is by being marked internal just go look at the SpriteFrameModule.cs, SpriteFrameModuleBase.cs, and the ISpriteEditorModule.cs files and try to add some new stuff to the SpriteFrameModule system in a simple form.

With Unity 6 release cycle being worked on I think this would be a nice time to set up for the future of the API with some changes to the underlining tools.

Thank you to all the Unity developers, staff members, and other community members that took their time to read this. I would like to hear other thoughts on this part related to Sprite Editor usage in code and in the editor itself. Have a great day.

Post two will involve the tile map side of Unity editor tools.

1 Like

It would be awesome being able to extend the Sprite Editor. I did it, I coded a clone of it and added the extra functionality I needed. I would have saved a lot of time if something like that was possible as a built-in feature.
Storing extra data into sprites would be also great.
The combination of both…

An issue that’s been causing me trouble is the inaccessibility of 2D Light Textures, which are currently computed by the internal 2D rendering passes of unity but are disposed before they end, and there’s no rendering event that allows to enqueue custom passes in-between their creation and disposal, making it effectively impossible to manually execute draw calls of sprites lit by them at any time within or outside the scope of the pipeline.

Another one, also in custom render passes, is the ScriptableRenderContext.DrawRenderers command correctly drawing sprite renderers but skipping any world space UI mixed in.

Other problems have already been reported and talked about for some time, so I’ll just link to their respective topics:

Thanks for looking into these.

Yes! This is exactly my problem. Programming is not an issue, but I have no idea how to make my game look awesome. Most of the stuff in Unity Learn is focused to 3D, and there is a lot of 2D awesomeness that I see out there and I’m always wondering how apply it to my works. Thank you for sharing this tutorial. Also, I know this may be old, but just recently found it, so it may add to the discussion (is and ebook and is free!):

Here is something for those keeping an eye on requests for updates to Sprite Editor workflow.
Currently making a small sprite editor window demo to show off ideas that would be useful for people using sprites in their game.

After I finish the current animation implementation tool and sprite data classes for it, I was going to show it here. It is mainly to show ideas for things that could possibly help users speed up their work speed when heavily working with a huge number of sprites.

It is made from the ground up without using Unity’s SpriteFrameModule API. I found just using both ISpriteEditor and the ISpriteDataProvider interfaces while making a brand-new core Sprite Editor class was a lot faster and easier to work with.

The idea is to show the idea of centralizing a lot of the tools used for 2D workflows in one spot.
It implements a set of overlays in the custom Sprite Editor for a few things.

Creating sprite animations and adding the animation to an animator controller.

  1. Allows for selecting multiple sprites and clicking a button or hitting a settable shortcut key to create an animation clip asset next to the sprite sheet asset from the sprite editor.
  2. Allows for choosing animation clips created from the current sprite sheet and generating an animation controller out of them.

Simplified Tile creation for making tiles out of sprites.

  1. This includes things for selecting multiple sprites at once in the editor and creating a rule tile, random sprite tile, or Animation tile.
  2. Selecting Sprites to set a default tile map layer to auto paint on if the auto select tile layer is enabled with the ability to create a new tile layer in the scene if the auto tile layer for the tile doesn’t exists.

There is more I want to add to the demo, but I honestly not sure how much time it would take so focusing on those first. The idea is also to show ideas for API to work with Sprites in the editor to make life a bit easier.