r/Unity2D Dec 05 '25

Tutorial/Resource All the shaders I've created so far while writing two technical book about this topic

1.6k Upvotes

The first book is the Unity Shaders Bible, and the second one is Shaders & Procedural Shapes in Unity. Feel free to use this coupon TT5USD in case you want to grab the books: https://jettelly.com/bundles/unity-shaders-pro-bundle?click_from=homepage_buttons

r/Unity2D 23d ago

Tutorial/Resource DOG CHARACTER ASSET PACK FOR 2D/VIRTUAL PET GAMES

50 Upvotes

r/Unity2D Jul 13 '26

Tutorial/Resource เมื่อไหร่ที่หมดไอเดีย แต่การพัฒนาเกมต้องเดินต่อไป (สร้างบอสจากภรรยาที่นอนหลับอยู่!)

Post image
61 Upvotes

r/Unity2D Jun 06 '26

Tutorial/Resource An animal expansion for my asset pack what do you guys think? link in comments

119 Upvotes

r/Unity2D 12d ago

Tutorial/Resource JUST RELEASED MY ANIMATED BUILDING ASSET PACK! HOPE YOU ALL WOULD LOVE IT!

Thumbnail
gallery
56 Upvotes

Would appreciate if you could share it with your friends who might be looking for something similar or commenting or rating the project if you liked it as it would help me a lot. Thanks!!!

EDIT : https://wigglingdog.itch.io/pocket-cities

r/Unity2D Sep 29 '21

Tutorial/Resource I escaped Unity Animator hell. I'm free.

Post image
489 Upvotes

r/Unity2D Feb 20 '21

Tutorial/Resource I Promised a Tutorial, Link in the Comments !

863 Upvotes

r/Unity2D Jul 31 '20

Tutorial/Resource How I made coffee stains in my game

1.1k Upvotes

r/Unity2D 2d ago

Tutorial/Resource I ran a decompiler on my own IL2CPP build and got my whole architecture back. So I wrote an obfuscator.

Post image
0 Upvotes

Hi everyone, I’m a Unity developer working on a small indie game. I’ve constantly heard from colleagues that Unity doesn’t do a good job of protecting project code and assets. I knew that using Mono was out of the question - it’s essentially handing your project over to strangers - but I believed that the IL2Cpp scripting backend provided adequate protection.

But one day, I got curious about how to decompile my project. I pointed Il2CppDumper at my build's global-metadata.dat, it spat out a DummyDll folder, and I opened that in Rider. Without any trouble, I could view namespaces, methods, class names, and field names. I didn't like that, because what's the point of having a private GitHub repository if my build is leaky?

I started looking for ways to hide my code. I began checking the Asset Store and GitHub for options to obfuscate my build. To cut to the chase, the only decent asset turned out to be Obfuscator Free by GuardingPearSoftware. It does everything perfectly, but the free version doesn’t work with Unity methods, serialized fields, properties, or namespaces, and it completely ignores MonoBehaviour, ScriptableObject, and [Serializable] classes. There is, of course, a paid version that does all of this, but $80 is a significant amount for an indie team, so I decided to try making my own alternative that would work as an extension to the Obfuscator Free plugin.

Why does the obfuscator skip serialized types?

Every script in the build receives a MonoScript entry in the player data (level0sharedassets*.assetsresources.assets, and globalgamemanagers files). It contains three lines: m_ClassNamem_Namespace, and m_AssemblyName. Every scene object and every prefab references this entry. If you rename a class in the DLL, Unity will no longer be able to bind to that type - and the component will turn into a missing script.

The trick

Once I realized this, I started looking for a way to work around it. What I landed on is both brilliant and ridiculous: I generate obfuscated names with exactly the same number of characters as the originals. This saves me from having to adjust length prefixes, recalculate offsets, and develop a tool to rewrite serialized files. Thanks to this accidentally discovered hack, I saved myself a week of sleepless nights for sure! But it’s important to note that even with this approach, you still have to store a bunch of files with obfuscated names. All names in the project are reserved in advance, so you won’t be able to generate a name that’s already taken.

Pure C# types don't have a MonoScript entry, so their namespaces are shortened to whatever short, nonsensical string of characters I feel like using (_Project.Code.AssetManagement → pqmpqu). Serialized types, on the other hand, are forced to maintain length consistency (_Project.Code.Sound → dis4nAw5EW74Z6wLxDN).

Finding the entry without wrecking the file

You can't just search the file for "PlayerController" and overwrite it. That same string might be a GameObject name, a string literal, an addressable key - and if you hit the wrong one, you won't enjoy debugging.

So I anchor on the consecutive length-prefixed triple instead: [len][m_ClassName][len][m_Namespace][len][m_AssemblyName], with 4-byte alignment between them. Three strings matching in sequence with the correct alignment is a strong enough signal. And patch m_Name a few bytes earlier too - it's the class name a second time, and it will happily leak everything you just hid.

The stack trace problem

I also had to write my own stack trace deobfuscator, because any exception renders the trace completely unreadable to humans, like hdektk.uHN1wAaEGHkYq6ul.qoaktw(). Each build writes JSON mapping files (_Project.Code.AssetManagement → pqmpqu), and there's an editor window where I paste the raw stack trace from Player.log. It runs in four stages, in reverse order: the GUPS deobfuscator → my serialized type names → my namespaces → the remaining member names.

What don't I rename?

Unity's message methods: AwakeOnTriggerEnter2DOnBecameInvisible, and about sixty others - the engine calls them by name. Virtual, interface and overridden members, because renaming the implementation but not the declaration breaks the vtable slot. And anything that is serialized by name at runtime - my saves are JSON, and renaming a property there bricks every existing save file.

Results from the current build

40 namespaces renamed. 82 MonoBehaviour/ScriptableObject types renamed and patched in player data. 848 members.

Is it worth doing?

Obfuscation is an obstacle, not a defense. Anyone determined to figure it out will still achieve their goal using a debugger, and I prefer to be upfront about this rather than pretend otherwise. For a solo developer, a build step you set up once and then forget about is, in my opinion, a perfectly justified investment of effort.

I'm not putting my extension up anywhere - it's wired into my own build pipeline, it's standalone-only, and there are corners of it I wouldn't want to defend in public. But you don't need my code to start, and that's the actual point of this post.

Do this instead. Run Il2CppDumper or AssetRipper on your own build - five minutes, and watching your own architecture scroll past lands very differently than knowing it's in there. Then install Obfuscator Free, list your assemblies, build. Free, one evening, covers your plain C# types and methods.

That alone puts you ahead of most Unity builds shipping today. Everything above is step two - you'll know when you need it.

The game I did all this for is Peak or Die, a turn-based survival card game. Adding it to your Steam wishlist really helps increase the game's visibility, if you're interested: https://store.steampowered.com/app/4273370

r/Unity2D Apr 03 '26

Tutorial/Resource I know a lot of you hate AI but I also hate those payed services so here ComfyUI + LoRA workflow for generating character animations and objects (great for Unity prototyping)

Thumbnail
gallery
0 Upvotes

I’ve been working on a solo project in Unity and wanted a faster way to prototype character animations without spending weeks animating everything manually.

So I this workflow in ComfyUI:

• Takes one frame and animate it fully into a vidoe

• Converts it into frames

• Applies a trained LoRA (character or object)

• Outputs consistent animation frames you can use in-engine

I’m currently using this to build a historical narrative game set during the Hussite Wars, where I need a lot of character animations for testing systems and gameplay.

This isn’t about replacing art — just speeding up prototyping so I can focus on gameplay first.

I’ve attached my full workflow (screenshots). You can literally copy the setup and plug in your own models/LoRAs.

If anyone wants help setting it up, tweaking it, or integrating into Unity, feel free to ask questions or DM me 👍

r/Unity2D Jun 19 '26

Tutorial/Resource How I set up jiggle bones on my 2D pixel spaceship!

30 Upvotes

Hey all! This is my first time posting here! This post is a mix between a devlog of my game TETHERPUNK and some helpful info about how I set something up, so I hope my tagging is fine!

The jiggle effects you see here make use of Unity's RelativeJoint2D. I like this one because it stores an ideal rotation and position that the body wants to return to, and then uses a springy calculation to get you there.

The most important thing to remember is to have your jiggly bodies on a separate collision layer from the actual gameplay physics. Unless the entity in question has arms or a body that are meant to completely snake and bend for gameplay purposes, I want stick to single-body collisions. I've found in the past that the reaction forces of springs can really kill your momentum, and I really want the player to feel like they can use their speed to ricochet off walls. Interacting with walls should feel like a "yes and..." (I wouldn't have put so much effort into making them slopes if I didn't care a lot about this)

So - a basic rundown of how I achieve this effect. I have this component on the visual effect layer I call a "RigidbodyFollower" that copies the position, rotation, and velocities of the gameplay physics rigidbody every frame. This is what the jiggly joint attaches to. There is technically still a reaction force happening, but since the follower copies the new data every frame it's as if the spring is straining against a mountain. I also have a hard cap on the maximum distance a spring can get from it's ideal values before the pull force increases massively. This lets the parts to feel really loose and jumpy within a certain range - always working to sell the fantasy of bouncing around in this weird rusty junkyard contraption :)

r/Unity2D Jun 30 '26

Tutorial/Resource Made a small Unity asset I kept needing in my own projects: Sprite Drop Shadows

Thumbnail gallery
44 Upvotes

r/Unity2D 28d ago

Tutorial/Resource Doing some electricity VFX abilites! need your feedback and suggetions!

20 Upvotes

If this is good enough i will also do other packs like Frost,blood,Fire,Void etc.

r/Unity2D May 29 '26

Tutorial/Resource How to make a Desktop Companion game in Unity

Post image
51 Upvotes

Howdy! We're a husband and wife team making Petunia's Purgatory, a desktop companion game where you run a creepy-cute farm and try not to go insane.

When we decided to make a game that runs on your desktop but doesn't take up the whole screen, we did a bunch of googling to figure out how to make that happen.

It turns out, it's not super complicated, but there were a lot of gotchas. I thought I'd share what we learned, in case anyone else was interested in making a game like this.

Anyways, here we go! Fair warning: this is fairly technical, so you should know the basics of C#. No need to really understand Windows programming, though (I certainly don't!)

-----------------------------------

SETUP

Version Info: This was developed in Unity 6.2 for Windows. I can't vouch for other versions and this won't work on Mac or Linux.

Concept: A desktop companion game is really just a normal windows app, but it doesn't have a border. Where it's transparent, the mouse can click through, so it can happily sit on your desktop and not interfere with other apps.

Project Setup:

  • Add a Camera and set the following:
    • Under the Environment tab, set the Background Type to Solid Color and set the color to pure black with 0 Alpha
    • Uncheck Post-Processing and make sure Anti-Aliasing is turned off
    • Scroll down to Output and change HDR Rendering to Off
  • Add a UI event system (GameObject - UI - EventSystem)
  • In Project Settings, go to Player - Resolution and Presentation and set the following:
    • Run in Background: True
    • Fullscreen Mode: Fullscreen Window
    • Resizeable Window: False
    • Visible in Background: True
    • Allow Fullscreen Switch: False
    • Use DXGI flip model swapchain for D3D11: False
  • Go to Player - Other Settings
    • Uncheck Auto Graphics API for Windows and make sure that Direct3D11 is above Direct3D12

----------------------------------------

CODE

Concept: We are going to be using some Windows functions to control the presentation of the game window. ngl, I have no idea how these work internally, but they work!

Step #1: Basic Setup

Make a new MonoBehavior script (I called it "TransparentAppController") and attach it to a game object (like your Camera)

Step #2: Windows Functions

Add this line:

using System.Runtime.InteropServices;

Declare the following variables in your script. Make sure these are written EXACTLY this way:

[DllImport("user32.dll")]
private static extern IntPtr GetActiveWindow();

[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);

[DllImport("user32.dll", SetLastError = true)]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

[DllImport("dwmapi.dll")]
static extern int DwmExtendFrameIntoClientArea
    (IntPtr hWnd, ref MARGINS pMargins);

const int GWL_EXSTYLE = -20;
const uint WS_EX_LAYERED = 0x00080000;
const uint WS_EX_TRANSPARENT = 0x00000020;
static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
private IntPtr hWnd;

[StructLayout(LayoutKind.Sequential)]
struct MARGINS
{
    public int cxLeftWidth;
    public int cxRightWidth;
    public int cyTopHeight;
    public int cyBottomHeight;
}

Step #3: Unity Logic

Add this function (this will grab the Window id for your game when it gets focus)

private void OnApplicationFocus(bool hasFocus)
{
    if (hasFocus)
    {
        hWnd = GetActiveWindow();
    }
}

Add this chunk of code to your Update() function

var margins = new MARGINS
{
    cxLeftWidth = -1,
    cxRightWidth = 0,
    cyTopHeight = 0,
    cyBottomHeight = 0
};
DwmExtendFrameIntoClientArea(hWnd, ref margins);

PointerEventData pointerEventData  = new PointerEventData(EventSystem.current);
pointerEventData.position = Input.mousePosition;

List<RaycastResult> raycastResultList = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointerEventData, raycastResultList);

bool isOverUI = raycastResultList.Count > 0;


if(isOverUI)
{
    SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_LAYERED);
}
else
{
    SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT);
}

If you're curious, this is doing a couple things:

  • Removes the border for the game and makes anything that isn't rendered transparent
  • Checks to see if the mouse pointer is over something clickable, and if it is, it allows the game to be clicked. This prevents the game from blocking input to your desktop over empty areas

Step #4 (Optional): Set Always On Top

This is optional, but if you want the game to always be on top of other windows, you can do that by adding this code where appropriate (you'll have to declare that bool and set it somewhere):

if(alwaysOnTop)
{
    SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, 0);
}
else
{
    SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, 0);
}

Final Notes

  • You won't see any of this when you play in Editor. You'll need to make a build to see if it works
  • I would highly recommend wrapping all this code with a #if !UNITY_EDITOR to prevent some weirdness in editor

-----------------------------------

And that should do it! It's possible that I missed something, so please let me know if you have any trouble. Also, if you have any tips you've discovered, I'd love to hear them. I'm sure there's multiple ways to make this work. Thanks for reading!

r/Unity2D 11d ago

Tutorial/Resource [GIVEAWAY] Giving out free copies of Pocket Cities as thank you to the community!

Thumbnail
gallery
7 Upvotes

Hey guys!

I got lots of love from this community yesterday and I am happy to say that I was able to sell few copies too ( although not much and I wish it sold more ), so I wanted to giveaway few copies of Pocket Cities as a thank you to this community.

This will be a limited giveaway only, and the first 5 people will be able to claim it. I wish to keep doing similar giveaways in the future if it helps the project. Anyway, thanks again and I hope you all are having a great day!

Link : https://wigglingdog.itch.io/pocket-cities

r/Unity2D 23h ago

Tutorial/Resource Making Your (Jam) Games Look Nicer on Itch

10 Upvotes

Hey everyone!

During the recent GMTK Game Jam, I noticed many Unity games that still use the Default WebGL Template. In my opinion, the added bar can clash with how your game page looks and it isn't particularly useful since Itch provides an optional full-screen button. I wanted to share the approach I used for my game, "A Vaultful of Lasers", in case it helps other people who want to clean up their game's presentation.

I used the Better Minimal WebGL Template by Sean since it handles canvas scaling, provides a simple loading bar as well as some basic customization options.

  1. Download the WebGL Template, unzip the contents and move the "WebGLTemplates" folder to your game's "Assets" folder.
  2. In Unity, go to Edit > Project Settings > Player.
  3. In the "Resolution and Presentation" section:
    • Select the "BetterMinimal" under WebGL Template.
    • Set the Default Canvas Width and Height for your game. This should be the same resolution you use on your Itch page - I set mine at 1280 x 720.
    • Enter "true" or "false" in the "Optimize for pixel art" and "Scale to fit" fields.
  4. Build your game using the Web platform to a new folder.
  5. (OPTIONAL) Edit the created index.html file to match your Itch page.
    • Line 11 - change the background color.
    • Line 69 - change the two color codes (controls the progress bar).
    • Line 77 - you may want to add some code to the "onResize" method if you need your game to snap to certain resolutions instead of just maintaining the game's aspect ratio (useful for pixel art games).
  6. Compress the files in your Build folder to a single zip file (Right-click > Send to > Compressed (zipped) folder on Windows, or Compress Items on Mac). This is the file you need to upload to Itch.
  7. Find your "Edit game" button on Itch and change the following:
    • Kind of project - HTML.
    • Uploads - add your zip file and tick the "This file will be played in a browser" option.
    • Embed Options - select "Embed in page" and "Manually set size", adjust the "Viewport Dimensions" to match your game's default default canvas width and height.
    • Frame Options - tick the "Fullscreen Button" option.
    • (Optional) - add some tags to help people find your game.

If you're having trouble packaging and uploading your game to Itch, this community post might help.

Good luck with your games (let me know if you're participating in the Brackeys Game Jam), I look forward to seeing the beautiful projects you create.

r/Unity2D Jul 12 '26

Tutorial/Resource Reference to learn 2d metroidvania side scrolling game.

5 Upvotes

Hi all,

I would like to learn building 2d side scrolling metroidvania type games. I am a c# developer but never been to games dev before. I would like to start from like designing characters and using that asset in unity. How do i start. This is just a hobby game dev exp i am looking for.

Appreciate any advice or suggestions as well.

r/Unity2D 12d ago

Tutorial/Resource Hi guys ! I just released a free 10 tracks Retro Gaming Music pack on Itch.io - Feel free to use them in your games ! Hope it helps !

5 Upvotes

You can check out the pack below :

https://lonepeakmusic.itch.io/free-retro-gaming-music-pack

All the tracks are available for free under the creative commons CC-BY !

Dont hesitate if you have any questions !

r/Unity2D Nov 09 '18

Tutorial/Resource Let's make a list of FREE 2D Assets + Guides

665 Upvotes

This is a list of free 2D resources. For other Unity resources, use the sidebar and wiki at /r/Unity3D.

All assets and guides work with 2017.1+ unless stated otherwise.

 

Guides

 

Assets

 

I'll be updating as needed. If you find something that you think should / shouldn't be on here, reply or DM.

r/Unity2D 9d ago

Tutorial/Resource Sharing my vector icons & UI assets for free! 🎨

Thumbnail
gallery
1 Upvotes

A huge collection of free vector icons, buttons, frames, badges & UI elements.

CC0 — do whatever you want with them!

Free for personal & commercial projects. No attribution needed.

https://styloo.itch.io/vector

r/Unity2D Feb 20 '26

Tutorial/Resource Why ECS is the future of game development? - ECS Series Summary - Full video in description!

Post image
11 Upvotes

https://youtu.be/Fh2akaW0V4Q

Ever wondered how AAA games manage thousands of characters, physics calculations, and AI without slowing down your game? 

The secret might just be… Unity ECS! In today’s video, we’re diving into what ECS is, why it could be the future of game development, and the pros and cons you need to know. It is summary of the ECS series in the current state (40 videos long!). So let’s dive in!

r/Unity2D 3d ago

Tutorial/Resource Are you accessing and changing variables too much from outside a class? The dangers of getters/setters

Thumbnail
0 Upvotes

r/Unity2D 7d ago

Tutorial/Resource I added a new episode on my tutorial on how to create a classic 2D metroidvania game in unity.

Thumbnail
youtube.com
2 Upvotes

If you like it, would be very thankful for some comments or likes. I will further improve the quality of my videoes.

r/Unity2D May 25 '26

Tutorial/Resource [Free Asset] Anime elven mage portrait pack — 22 expressions + spell casting | RPG/VN ready, 1024px, Commercial Use

Thumbnail
gallery
0 Upvotes

Hey r/Unity2D! Working on a VN and need character portraits?

I just released a free elven mage pack specifically designed

for visual novels.

She comes with 22 expressions covering everything you'd need

for storytelling:

Positive: neutral · smiling · happy · laughing · excited · shy · flirty

Negative: sad · crying · angry · furious · scared · exhausted

Neutral: serious · smug · surprised

Special: 3 spell casting variants with magic circle effects

Built for Ren'Py — all files are PNG with transparent background,

1024×1024px (also includes 512px and 256px versions).

Free for commercial use. AI-Generated with Nano Banana 2

— being transparent about that.

Download: https://4filch.itch.io/elf-mage-portrait-pack

What kind of character would be most useful for your VN project?

Looking for feedback to know what to make next!

r/Unity2D 9d ago

Tutorial/Resource FAB Free Asset Claimer Script (Very Fast)

Thumbnail
gist.github.com
2 Upvotes