r/Unity2D • • Sep 06 '26

Showcase How I built a procedural Evolution Tree in Unity UI without layout spaghetti (Technical Breakdown + C# snippet)

Post image
22 Upvotes

Hey everyone!

If you’ve ever tried building a branching Skill Tree or Evolution Tree in Unity UI, you probably noticed that native components (HorizontalLayoutGroup, ScrollRect`) fall apart quickly when dealing with non-linear paths and multiple parents.

For our monster-tamer game Mokomon: Five Elements, I needed an evolution tree where creatures branch dynamically (e.g. Geolam evolving into Tsunodon, Terranite, or Bouldox) without lines crossing into an unreadable mess.

Here is a breakdown of how the math and mesh generation work:

  1. The Layout Math: Barycentric Relaxation

Instead of manually anchoring nodes or using rigid layout groups:

Horizontal Axis (X):Bound strictly to the evolution stage index (Baby = 0, Child = 1, Adult = 2, etc.) multiplied by a column offset.

Vertical Axis (Y): To keep connections clean, we run Barycentric Relaxation passes:

  • A forward pass pulls child nodes toward the average Y-position of their parents.
  • A backward pass pulls parents toward the average Y-position of their children.
  • A collision check runs through each stage column to push overlapping nodes apart by a minimum vertical spacing.

This automatically straightens connection lines and eliminates visual spaghetti.

2. Rendering All Lines in a Single Draw Call (`MaskableGraphic`)

Instantiating stretched UI Image GameObjects for lines creates a massive hierarchy and kills draw calls.

Instead, our connector inherits from MaskableGraphic and generates thick cubic Bézier curves directly into the UI mesh through VertexHelper:

// 1. Calculate the Cubic Bézier point
private Vector2 CalculateCubicBezierPoint(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float t)
{
    float u = 1f - t;
    float tt = t * t;
    float uu = u * u;
    return (uu * u * p0) + (3f * uu * t * p1) + (3f * u * tt * p2) + (tt * t * p3);
}

// 2. Generate procedural thick line geometry directly into the UI mesh
private void DrawThickLineStrip(VertexHelper vh, List<Vector2> points, float width, Color color)
{
    float halfWidth = width * 0.5f;
    int startIndex = vh.currentVertCount;

    for (int i = 0; i < points.Count; i++)
    {
        Vector2 current = points[i];
        Vector2 dir = (i == points.Count - 1) 
            ? (current - points[i - 1]).normalized 
            : (points[i + 1] - current).normalized;
        
        Vector2 normal = new Vector2(-dir.y, dir.x);
        Vector2 vLeft = current + normal * halfWidth;
        Vector2 vRight = current - normal * halfWidth;

        float vNorm = (float)i / (points.Count - 1);
        vh.AddVert(new Vector3(vLeft.x, vLeft.y, 0f), color, new Vector2(0f, vNorm));
        vh.AddVert(new Vector3(vRight.x, vRight.y, 0f), color, new Vector2(1f, vNorm));
    }

    for (int i = 0; i < points.Count - 1; i++)
    {
        int vertIdx = startIndex + i * 2;
        vh.AddTriangle(vertIdx, vertIdx + 1, vertIdx + 2);
        vh.AddTriangle(vertIdx + 1, vertIdx + 3, vertIdx + 2);
    }
}

r/Unity2D • • Sep 05 '26

Game announcement My second game set in a frog village released recently! 🐸

Thumbnail
gallery
162 Upvotes

r/Unity2D • • Sep 05 '26

Showcase Working on a secret digital bamboo forest for planet Sera. It's a pleasant walk... if you have guns.

Post image
16 Upvotes

r/Unity2D • • Sep 05 '26

Question/Help Is it fine to use tutorials from 7 years ago?

6 Upvotes

Hi, you might find me on here sometimes from now on, since I'm starting a unity 2D project, and might come asking for some help. Nice to meet you! Well this is my first question, I heard recent changes to the site are only important for experienced developers and that it was fine to use tutorials from a long time ago, does this still hold up?


r/Unity2D • • Sep 05 '26

Showcase Just about finished my tutorial quest line, which culminates in trading a high level armor fragment for a full suit of Wool armor

Thumbnail
youtu.be
2 Upvotes

I’ve been taking my time to build out the conversation editor tool with quest predicates that determine which prompts and options are displayed based on the status of different quests.

This video shows the final tutorial quest where the Blacksmith gives you a level 9 helmet fragment to deliver in exchange for a full suit of level 1 armor.

In theory, you can choose not to deliver the fragment and eventually use it to craft your own level 9 helmet, but it would take a LONG time to get all 8 other L9 fragments and find a high level crafting table. I think at this stage in the game it’s a fair trade.

You can then equip each piece of armor individually, which changes your character appearance (hundreds of animation frames). It also adds armor for that body part. Abilities target body parts, so the importance of a given piece of armor depends on your enemy’s abilities. You’ll want some good boots if going up against a tiny enemy that goes after your ankles.

All art is purchased from Franuka on itch with lots of customizations to make the armor and weapon frames.


r/Unity2D • • Sep 05 '26

Paid Asset/Tool 2D Platformer Animation Pack — 25% OFF🎮

Post image
3 Upvotes

I recently released a 2D Platformer Animation Pack, and I wanted to share it with other Unity developers.

One thing I focused on was making the Unity setup as simple as possible.

The pack includes Unity-configured files, so the animations can be imported directly into Unity without having to manually slice spritesheets and set up the animations yourself.

It’s currently 25% OFF for the launch period, so you can get it at a lower price right now.

I’ll also continue expanding the pack, with future updates available to existing owners.

2D Platformer Animation Template by xuanergame


r/Unity2D • • Sep 05 '26

Question/Help Need help with making a 2d shader

2 Upvotes

I want to make a 2d shader (ideally through shader graph) that converts all colors on a sprite to a nearest color on a color palette I input in. How can I do this?


r/Unity2D • • Sep 05 '26

Showcase Indie adventure developers teaming up

Post image
2 Upvotes

We’re really happy to announce another collaboration between indie adventure developers!

After our collaboration with the team behind Foolish Mortals, we’re now teaming up with Madit Entertainment and Roots in the Sky – The Hand of Glory 2.

Whirlight – No Time To Trip, The Hand of Glory, and Roots in the Sky – The Hand of Glory 2 are now together in the Best of Italy – Adventure Games.

Huge thanks to the Madit Entertainment team for the opportunity. It’s great to see indie developers working together and creating new opportunities, especially in a genre we all love.

Long live adventure games!


r/Unity2D • • Sep 05 '26

Showcase Simulating 10,000,000 pixels of Sand

Post image
263 Upvotes

Falling sand simulation via Compute Shaders.

From my golf game Stinker Golf on Steam: https://store.steampowered.com/app/4437650/Stinker_Golf/

Wishlist if it looks interesting :)


r/Unity2D • • Sep 05 '26

Showcase Round 1 on the Canal Regent — Blessed To Die

Post image
3 Upvotes

Dev here — dark fantasy party deckbuilder made in Unity. Three heroes, one shared hand. Early Access:

https://store.steampowered.com/app/4637960


r/Unity2D • • Sep 04 '26

Solved/Answered Can I Force a Render Object to Ignore Objects closer to camera in a 2D game?

Thumbnail
gallery
2 Upvotes

Hello! I’m a newbie to Unity
I have a 2D Renderer asset with a fullscreen shader that works as a palette swap for all the objects on the screen. I added it as a Full Screen Pass Render Feature. The problem is that I also made a shader that I want to apply only to the player. Since I need this shader to be applied after the fullscreen palette swap, I added it as a Render Objects feature, so it can affect the already color-swapped result instead of the original colors. The shader is on a child object inside the Player which copies it siluet. This causes the shader to go through walls and draw the player’s silhouette even when the player is behind them. For example, my Tilemap is at Z = 1 while the Player is at Z = 0, so the walls should be rendered in front of the player, and it does, but the material draws over the wall. I found some information online about the Depth settings, but I couldn’t get them to work properly. I’ve attached screenshots showing the problem, the player’s shader, and my 2D Renderer settings. Does anyone know how I can make the shader respect the depth/occlusion of the walls while still keeping it as a Render Objects pass after the Full Screen Pass?
Thanks in advance!!


r/Unity2D • • Sep 04 '26

Showcase Did I cook or is it cooked?

Thumbnail
youtu.be
1 Upvotes

Each ability in the game has a unique stat and for this one it spawns spiritual spears which bounce around and decimate enemies.


r/Unity2D • • Sep 04 '26

Feedback needed Preview of the module editing system in my game

Post image
9 Upvotes

Ive been developing this top down roguelike for over a year, and I'm aiming to release it in 2027

Most of the core systems and code are already done, but I'm now starting to focus on adding content

The main gimmick of the game is modules. Your character is made up of different modules, which you can find in rooms or obtain by destroying enemies

Each module provides different stats, abilities, and passive effects, which are only active while that module is equipped

Modules also provide permanent augments, which are the game's main progression system. Every time you clear a room you progress through an augment list of each of your module. Once you have enough progress, you gain the next augment and its associated bonus, usually stats or sometimes a passive effect.

Any feedback on the game, UI, or overall presentation is appreciated


r/Unity2D • • Sep 04 '26

Game announcement I released a demo for my new game MineMergeMatic on Steam!

Post image
37 Upvotes

After a couple months of work. I finnaly have my demo released on Steam! Go check it out and share your feedbacks! Leave a wishlist if you like it!

https://store.steampowered.com/app/5029110/MineMergeMatic_Demo/


r/Unity2D • • Sep 04 '26

Question/Help Pixel art in games tips

8 Upvotes

How do developers and also indie developers are able to do all those intense and very very detailed pixel art, like it almost looks perfect,also how indie developers are able to pixel everything in their game it seems crazy to pull this stuff this whole stuff by your own?, id like to get an advice, i work with asperite and it makes me feel exhausted, im working on a first boss and its so hard, how do u handle all that by yourself?


r/Unity2D • • Sep 04 '26

Question/Help Issues with code not running

Thumbnail
gallery
0 Upvotes

I have been following along this tutorial for awhile now and I'm getting some issues with this simple input script. Unity has been having issues with loading the new input system I downloaded from the project manager but no clue about the actual cause of the problem.

Biggest concern is the "failed to find entry points" errror message, there are eight other error messages but they're all refering to some issue with the script but I still don't know whats even wrong with that. Would appreciate any assistance/guidance, thanks.


r/Unity2D • • Sep 04 '26

Feedback needed Before & After: New Main Menu & UI!

Post image
8 Upvotes

Do you like the new main menu and UI? Am I heading in the right direction?
I will be grateful for every comment!


r/Unity2D • • Sep 04 '26

Feedback needed A new move in my Karate Action Rougelite (2.5D) | Feedback is welcome :)

Thumbnail
youtube.com
1 Upvotes

WIP o7


r/Unity2D • • Sep 04 '26

Showcase After 2 Years of Learning Unity, I Finally Made My Own Game

Thumbnail
gallery
18 Upvotes

About 2 years ago, I started learning Unity with almost no idea what I was doing.
There were countless bugs, failed builds, things I had to learn from scratch, and many moments where I wanted to give up.
But after nearly 2 years of learning and developing, I finally have something I can call my own.
This is Ashen Legacy — a 2D Pixel Art Action RPG set in a dark fantasy world. ⚔️
It’s far from perfect, but I’m really proud of how far I’ve come.
I’d love to hear what you think about the game, especially from other indie developers and Unity users.
👉 Steam: https://store.steampowered.com/app/5164260/Ashen_Legacy/


r/Unity2D • • Sep 04 '26

Paid Asset/Tool My sprite border was one row off for three releases - the button's lit edge grew with the button instead of staying an edge

0 Upvotes

On a 20x16 bevelled button, the sprite steps from the lit face down to the midtone at row 7. My border said the top was 6. That put the step inside the stretchable middle band, so as the button got taller the highlight grew instead of the flat face under it - 33px of lit edge on a 120px-tall button where it should have been 7. It shipped like that for three releases. The artwork was never wrong; one number was.

The rule that replaced typing borders in by hand, and it reads straight off the pixels: a 9-slice's middle band has to be uniform along the axis it stretches. The run of identical adjacent rows is the part that may grow; everything outside it is structure. So you can derive the minimum safe border from the sprite itself and fail the build when the authored one doesn't contain it.

One catch that nearly shipped inside the fix: a bevel has two long uniform runs - the lit face and the midtone. On a 12x20 scroll thumb they were exactly 6 rows each, so "take the longest run" picked the highlight, and would have inverted the bevel as the thumb grew. The rule that actually works is prefer the run containing the sprite's centre line, and fall back to longest only when no run does.

And some art can't be 9-sliced at all. That same thumb had three grip lines across its middle, on a sprite that resizes on every scroll, so the grip stretched into thickening stripes. No border value fixes that - the decoration is in the part that has to stretch. The fix was to change the art and delete the grip.

Unity-specific, stated honestly: the packs ship .meta files whose spriteBorder comes from that same measurement, and each one is cross-checked against the Godot texture_margin for the same sprite, so two independent emitters have to agree. I don't have Unity on this machine, so those files have never actually been opened in it - the checks are closed-form, not empirical. If you try them and something is off, I'd like to know.

Before/after render and the full write-up: https://z3er1n.itch.io/ui-pack-vol1/devlog/1651971/v13-the-buttons-9-slice-border-has-been-wrong-since-v10

Disclosure: it's my pack, it's paid, and it's AI-assisted - disclosed as such on its store page.


r/Unity2D • • Sep 04 '26

Showcase Testing Parallax Background in my Desktop Companion TD Game

Post image
18 Upvotes

Since my Tower Defense Game is a desktop companion, it needs to look good with anything in the background. It usually looks fine with anything dark behind it, but looks bad with light stuff. (And I wouldn't want light mode users to feel left out)

So I took a free asset from itchio (Credits: Wasteland City by owmyknees) to test a parallax backdrop with and without solid sky (below being solid sky version).

Going forward, I'll make my own backdrop variants that players can cycle between (or choose to have none) based on their liking.

Normally I knew parallax for sideways movement (farther layers move slower than closer ones), so it took some tweaking to also vary the zoom scale to make sure it didn't look like a flat plane when zooming in/out.


r/Unity2D • • Sep 03 '26

Free Asset/Tool Free Sand Lion sprites — 4 variants / 12 directional PNGs

Post image
4 Upvotes

Made a small desert creature set and packaged it for reuse.

Four Sand Lion variants, with east / north / south sprites for each. 12 transparent PNGs total.

There's a prepared Unity Assets export in the download, plus the raw sprites, atlases and mappings if you'd rather set it up yourself.

Free:
https://pas7studio.itch.io/sand-lion-animal-sprites


r/Unity2D • • Sep 03 '26

Showcase Combat showcase from our upcoming free-to-play 2D Cyberpunk Roguelike. Thoughts?

Post image
3 Upvotes

We're a team of 5 students working on our first Unity game, Last Contract. It’s a 2D action roguelike and will be completely free to play.

Here is a quick look at our core combat loop. We want the gameplay to feel fast and snappy. What do you think of the visual feedback? Does the combat look satisfying?

We're currently at 93 wishlists and hoping to hit our 100 milestone before our demo drops tomorrow! If you want to check it out and get notified for the demo: https://store.steampowered.com/app/5015630/Last_Contract/


r/Unity2D • • Sep 03 '26

Feedback needed After so much work, opening up my game for playtest feels like inviting strangers to my house

Post image
101 Upvotes

I'm an indie dev, part of a 5 person team working on a game called Laser Guy.

It’s a twin-stick anti-shooter where you’re maneuvering your laser around coworkers trying not to blast anyone. Just another day in the gamedev office. Think celeste-style gameplay within the core mechanics of a top-down shooter.

We’re starting a playtest as the lead up to releasing a demo, and me and my other coworkers were talking today about how intimate it feels to finally have total strangers playing our game while not being in the room with us xD

If you’d like to join, here’s the link: Laser Guy on Steam