/r/Unity2D

Photograph via snooOG

This is a subreddit for 2D or 2.5D game developers using the proprietary Unity game engine. New and experienced Unity developers alike should first consider using the free and open source Godot engine by default and ONLY choose Unity for 2D development if Godot isn't capable of the task. The times are quickly changing, and Godot is on track to surpass Unity for small developers.

About

This is a subreddit for 2D or 2.5D game developers using the proprietary Unity game engine. New and experienced Unity developers alike should first consider using the free and open source Godot engine by default and ONLY choose Unity for 2D development if Godot isn't capable of the task. The times are quickly changing, and Godot is on track to surpass Unity for small developers.

Getting Started


Godot Features

Download Godot

Godot Docs

Download Unity

Unity Manual

Official Reference

Asset Store

Software

Related Communities

/r/Godot - The "Unity Killer". A fully free and open source engine making astonishing leaps and bounds.

/r/UnityAssets - Share asset packs!

/r/PixelArt - Admire, share, and observe beautiful pixel art.

/r/GameDev - Meet and communicate with other game developers.

/r/GameDesign - Don't just make a game. Make a good game.

/r/LevelDesign - Learn to make excellent levels and worlds.

/r/GameAudio - It may look good, but does it sound good?


CSS created by Sean O'Dowd @nicetrysean [Website]

/r/Unity2D

156,683 Subscribers

1

How can I make this scene on Unity? I am totally lost:(

Hello, fellow developers!

I'm working on recreating a scene similar to one from Nine Sols in Unity, but I've hit a roadblock and could really use some advice.

https://preview.redd.it/2ojdakgwur4e1.png?width=1477&format=png&auto=webp&s=efe91bd7b9ba944603e7925aa0ecd889d7463efe

https://youtu.be/vv9vNhosRfg?si=P4_l4PqwAhkEoZlu&t=24540

I want to make a layered look like this scene, but I'm not sure if they used shaders or some other technique to pull it off. On top of that, the mechanics in the scene change dynamically, which makes it even harder for me to wrap my head around.

I'm also struggling to figure out how to implement that wavering effect—I'm not sure if it's done with sprites, shaders, or something else entirely.

If anyone has insights into how this might have been implemented, or any resources you could point me to, I’d be incredibly grateful!

By the way, this is my first time posting on Reddit, so if I’ve made any mistakes or posted in the wrong place, please let me know!

Thanks in advance for your help!

0 Comments
2024/12/04
05:59 UTC

2

You Can Parry Super Attacks In My Basketball-Brawler, Layup Legends!

1 Comment
2024/12/04
05:04 UTC

2

Reverse animation

So I’m making a game similar to flappy bird and I want the wing flap animation to go back and forth instead of a looping animation how can I do this or can I do this?

3 Comments
2024/12/04
01:12 UTC

2

Struggling with Pixel Perfect Camera, Cinemachine Follow, & URP

Hey there, I am looking for some help with the camera in my 2D Unity pixel art platformer game. When trying to use the pixel perfect camera and a cinemachine virtual camera to follow the player character I'm running into an issue of the camera being jittery. I was able to follow some youtube tutorials and unity documentation to make it so the character itself looks smooth by turning off dampening and making sure my PPU are all set to 16 and my reference ratio was 320x180 with pixel snapping turned on. However, the background tilemap/assets all still get weirdly blurred (even though their sprites are also set to 16 PPU). I think it is related to the camera movement.

When I select my cinemachine and enter game view, there are visual indicators that appear like a yellow dot on the player character. This yellow dot is clearly jittering when I move the character and my best guess is that there is some dysnch with the player and camera movement.

I am also using URP, I'm not sure if that could interfere with the way everything works together? If I disable the pixel perfect camera there is no more jittering. Are any of these components not use-able with each other? I've seen plenty of pixel art games developed in unity that have very clear/crisp pixel art with moving cameras and nice lighting effects so I know it must be possible.

I am new to programming and game development. I've been able to use Unity documentation and youtube to overcome most hurdles so far but this camera jitter has got me stuck. With some googling I can see similar-ish problems but I don't have a strong enough technical understanding to know if those problems are related to mine. I've seen some forums describing needing to making sure you player movement and the camera movement are both in FixedUpdate but that didn't seem to help my problem.

If anyone can offer some advice or point me in the right direction to try to learn more about camera movement in unity 2D pixel art games that'd be super helpful!
Thank you very much!

0 Comments
2024/12/03
21:12 UTC

22

We tried to make a 2.5D game. Going for this style was both a blessing and a curse, link and more in comments!

4 Comments
2024/12/03
20:13 UTC

1

Problema de lineas entre tiles

Estoy empezando en Unity y no logro solucionar el error que muestra como una linea entre los tiles, he probado de todo, quitar el Anti-aliasing, el tile map esta en "Composite Operation: Merge", los tiles estan en "Filter Mode: Point(no filter)"... Y alguna cosa mas que he estado tocando pero no consigo solucionarlo. Alguna idea?

https://preview.redd.it/j2i1uhorvo4e1.png?width=863&format=png&auto=webp&s=dc7c1fe34f3e848ee4b10de123e75a27489c0b35

0 Comments
2024/12/03
19:59 UTC

14

The Performance Game-Changer 😎 BlobAsset in Unity ECS - with Example! ❤️ Link to Full Tutorial in the Comments!

1 Comment
2024/12/03
17:38 UTC

4

Working on a teleport shader for my player

https://i.redd.it/xtl0sotw3o4e1.gif

I've been working on a teleport shader for my game Dreamwalker. The player is part of a 256-frame spritesheet, and I'm trying to figure out how to apply the shader to the current animation being played instead of affecting the whole spritesheet. Anyone have tips? tnx

0 Comments
2024/12/03
17:29 UTC

1

One button jam - my experience

Actually this is my second game jam I've participated. I was not able to finish the game and submit it before the deadline on the previous jam. So, I decided to make the game mechanics as simple as possible and the game jam's theme actually helped me as the game has to be controlled using only one button.

I planned to develop a game where the player has to write as many lines of code as possible before the timer runs out by holding the space button. In the same time the player has to smash the bugs entering into the keyboard before it affects the code. I started the development and coded the bugs spawn and hit mechanics.

Next I decided to start developing the code typing mechanism. I thought it will be easier as the controls is only one button, but it made it difficult to implement the holding mechanics and gave a lot of errors which may lead to change the code I've worked on before and I didn't have enough time to complete it as I was writing exams and I have to spend time preparing for the exams. So I decided to make the game as only to hit the bugs and added the score and the timer system. Finally I added the menu and game over screens.

I planned to access the UI only using the space button and I was not able to implement it too. Finally I submitted the game on the jam submission page. Today I've checked the jam page and I saw that the submission time has been extended and I fixed a bug in the game my friend noticed and updated it.

Please try and give your thoughts on the game which is available in my itch.io page only if you are free and you have 60 seconds to play my game : ). I've attached the link for the game in the post.

https://santhosh-abraham.itch.io/hit-the-bugs

2 Comments
2024/12/03
16:37 UTC

2

New developer

Hi, i’ve just started out with Unity (Unity 6 being my first) and was wondering if the code from previous versions works on this version as well, i followed along with a tutorial on a 2D character controller, however the script did not have everything they had in the video, the question isnt urgent as im just working on a small project at the moment (a metroidvania inspired by Hollow Knight)

3 Comments
2024/12/03
12:53 UTC

7

I have this Weird Unity Font Bug! It seems to only happen to a few specific numbers.

6 Comments
2024/12/03
08:50 UTC

5

Day 3 working on my game: I programmed an array to store inputs and framecount for Motion Inputs.

0 Comments
2024/12/03
04:45 UTC

0

need help with flipping enemy

so im making a simple floating enemy, it moves, hits a wall and flips depending on the direction. the enemy functions perfectly but when trying to vertifcally flip after hitting a ceiling, the whole character sprite flips. Ive tried just doing -rb.velocity.y but it doesnt work. ive also tried creating an upside down animation but thats not working either... any help?

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class floater : Enemy

{

[SerializeField] private float flipWaitTime = 1f;

[SerializeField] private LayerMask wallLayer;

[SerializeField] private float detectionRadius = 0.2f;

[SerializeField] private Transform wallCheck;

[SerializeField] private Transform ceilingCheck;

[SerializeField] private Transform groundCheck;

private float flipTimer = 0f;

protected override void Start()

{

base.Start();

rb.gravityScale = 0f;

rb.velocity = new Vector2(speed, speed); // Ensure initial movement

}

protected override void Update()

{

base.Update();

if (PlayerController.Instance.pState.alive)

{

ChangeState(EnemyStates.Floater_Idle);

}

UpdateEnemyStates();

}

private bool IsObstacle(Transform checkPoint)

{

return Physics2D.OverlapCircle(checkPoint.position, detectionRadius, wallLayer);

}

protected override void UpdateEnemyStates()

{

if (health <= 0)

{

anim.SetTrigger("Death");

Death(Random.Range(1, 2));

rb.velocity = Vector2.zero;

return;

}

switch (currentEnemyState)

{

case EnemyStates.Floater_Idle:

Move();

if (IsObstacle(wallCheck))

{

FlipHorizontalDirection();

}

if (IsObstacle(ceilingCheck) || IsObstacle(groundCheck))

{

FlipVerticalDirection();

}

break;

case EnemyStates.Floater_Flip:

flipTimer += Time.deltaTime;

if (flipTimer > flipWaitTime)

{

flipTimer = 0f;

ChangeState(EnemyStates.Floater_Idle);

}

break;

}

}

private void Move()

{

float horizontalDirection = transform.localScale.x > 0 ? 1 : -1;

float verticalDirection = transform.localScale.y > 0 ? 1 : -1;

rb.velocity = new Vector2(horizontalDirection * speed, verticalDirection * speed);

Debug.Log($"Moving: Velocity({rb.velocity.x}, {rb.velocity.y})");

}

private void FlipHorizontalDirection()

{

transform.localScale = new Vector2(-transform.localScale.x, transform.localScale.y);

if(transform.localScale.y < 0)

{

anim.SetBool("flipped", true);

}

else

{

anim.SetBool("flipped", false);

}

}

private void FlipVerticalDirection()

{

transform.localScale = new Vector2(transform.localScale.x, -transform.localScale.y);

}

private void OnDrawGizmosSelected()

{

Gizmos.color = Color.red;

if (wallCheck != null) Gizmos.DrawWireSphere(wallCheck.position, detectionRadius);

if (ceilingCheck != null) Gizmos.DrawWireSphere(ceilingCheck.position, detectionRadius);

if (groundCheck != null) Gizmos.DrawWireSphere(groundCheck.position, detectionRadius);

}

}

6 Comments
2024/12/02
19:23 UTC

2

How to Implement Realistic Physics for a Cape in a 2D Pixel Art Unity Project?

I'm working on a 2D pixel art game in Unity. I want the cape to move realistically based on physics, adding a touch of life to the character's animations. However, I haven’t found many resources on this topic online, so I’m wondering if there are any guides or references I could use.

Here is my character:

https://preview.redd.it/ew9tmf6m8h4e1.png?width=495&format=png&auto=webp&s=d9f7fa548f37a87ea58d0536c6ced148148f0285

1 Comment
2024/12/02
18:17 UTC

3

Help

I can't get this to download. I tried removin the files and redownloading them, uninstalling Unity Hub and reinstalling it and I ran it as Administrator. Nothing worked, I am stuck here.

I have also made a Unity account and have linked it to my Unity hub and I have also added a Personal license to it.

What else can I do here, as I really don't understand what the issue could be for this to fail every time.

2 Comments
2024/12/02
18:14 UTC

2

Why my character is stuck in a small map?

I created a 2d tilemap game and put a character in, and for some reason there are invisible walls all around and I can't move past them. I want to make the map a lot bigger but i can't go past a certain point with my character? What am I missing? I can't find anything on the Google about this.

5 Comments
2024/12/02
17:41 UTC

1

NEED HELP WITH BUILD SETTINGS

Alright so i cant seem to understand why my game looks so different from when i play it on the editer vs when i run it on andriod . I dont know if it's the export settings or something. Can't someone tell me the most optimal settings for exporting a game on andriod in which it runs on a stable 60 frames per second

1 Comment
2024/12/02
15:16 UTC

7

What is used in unity for UI animations? Plain code?

I've seen some recent posts of games with UI and they are animated like when a menu shows up they move towards the center of the screen from one side of the screen, or when you click an arrow it moves to the next screen with speed etc...

What is the best way to do this? Do i use components too like the unity way and make each one have a behaviour? like for example MoveToCenter (would contain speed, bool for to use lerp or not, etc)

or is there any package or library recommended for UI animations?

11 Comments
2024/12/02
13:07 UTC

2

Hero Spotlight - Here's Aria, the Nature Ranger!

3 Comments
2024/12/02
12:35 UTC

35

Unity UI - neat little animation trick that indicates to the player he can drop one of the items in between the other items, pushing aside other elements - explanation in comments

9 Comments
2024/12/02
06:31 UTC

Back To Top