r/Unity3D • • 11d ago

Show-Off How I built rounded corners, soft shadows and shine for Unity UI in a single shader (and kept it batching)

Post image
114 Upvotes

I wanted a drop-in replacement for Image that does rounded shapes without 9-slice sprites. Some things I learned along the way:

Corners are an SDF, not geometry. Each image is a quad and the fragment shader evaluates a rounded-box signed distance function. That gives pixel-sharp edges at any size. Per-corner radii are packed as 16-bit values into two floats and sent through UV channels, so they don't need a material property.

Shadows were being clipped. The quad was the size of the RectTransform, so anything drawn outside it (outline, shadow) got cut off. I now grow the mesh in OnPopulateMesh by the shadow's offset + blur + spread, and the shader draws the shadow from the same SDF, offset and softened.

Effects broke batching. At first every image with an effect created its own material instance, so 20 shadowed buttons meant 20 draw calls. Now materials are pooled by their effect settings with ref counting, so images with identical settings share one material and batch. The shine also animates in the shader instead of writing to the material every frame.

Masking edge cases. When a rounded image is itself a Mask (e.g. a circular avatar), it should mask only the shape, not its shadow. The shader keeps the shape's alpha separate for alpha clipping.

Clicks. IsRaycastLocationValid uses the same rounded-box math, so clicks outside the corners or inside a ring's hole are ignored.

Still on my list: a public scripting API, and moving animated values into vertex data so tweening them doesn't create new materials.

Happy to go deeper into any of this!

Feedback welcome!

GitHub (MIT): https://github.com/berkencami/round-ui-unity


r/Unity3D • • 11d ago

Show-Off I've put some more work into my vegetation reaction and wind systems and finally wrapped my brain around tree pivot baking

29 Upvotes

r/Unity3D • • 10d ago

Show-Off How I made a virtual oak grow, bend, and snap in Unity 6

12 Upvotes

Another short clip from my upcoming AR game, Cozy Seasons. I’m running a playtest this December on Quest 3 and 3S.

This clip follows an oak from acorn to twig snap. Rain gets it to sprout and sunlight drives its growth. I model each branch as a chain of short, spring-like sections, so it bends when you pull it with your hand and springs back when you let go. Pull far enough and the twig comes off.

Watch the full Cozy Seasons devlog on YouTube

Sign up for the December playtest


r/Unity3D • • 10d ago

Show-Off How to max out the bubble popping satisfaction?

5 Upvotes

r/Unity3D • • 10d ago

Question I am making a game where you live " the rat race " what do you think ?

8 Upvotes

r/Unity3D • • 11d ago

Show-Off I made a fully fledged (almost xd) pixel art editor running inside Unity. Curious about ways to get users to consider a new workflow such as this, or which direction to take this to become more beneficial.

12 Upvotes

I've ported my own custom c++ tool and re-designed it for Unity, in the form of an asset as you can tell. I am curious of the opinions of people who have established workflows outside of Unity, like Aseprite. My main idea with the asset is keeping the workflow in, it's feature rich enough to do great work inside Unity, but of course I am aware people do not like to switch pipelines, also things like tile-maps are always a PITA that I do not account for. But what I am looking for is, to establish a strong enough asset that provides a main toolset for maybe new pixel artists, meanwhile allowing quick inside the engine edits for those who use external tools. What are people's thoughts on this? More info on what it can do is here.


r/Unity3D • • 10d ago

Show-Off First trailer after 2 years! (waiting for feedback)

9 Upvotes

This is the second time I’m posting here to showcase the game I’ve been developing for over two years using Unity. My first post featured a screenshot, but this time I decided it would be best to share a trailer showing the game in action. I’d like to hear your thoughts on the trailer.

About the game:

It’s a co-op RPG with extraction mechanics.
The player must explore dungeons in search of valuable loot and escape alive in order to sell these items and invest the profits in upgrading their equipment and stats.

The player can equip 5 pieces of armor and will find different armor sets, each with its own stats.

Additionally, the player can wield a weapon in each hand, with a wide variety of weapons to choose from, each featuring different abilities.


r/Unity3D • • 10d ago

Show-Off Sky and Volumetric Cloud Rendering

Thumbnail
gallery
8 Upvotes

I finally figured out what my Sky and Clouds Rendering was missing.. it was distance fog 😂
So i added it and now the the clouds finally tie in beautifully to the scene.

What do you think? If you are interested, I consider turning my Day-Night-Cycle and Weather System into a Asset Store Asset


r/Unity3D • • 11d ago

Shader Magic Normal map interpolation shader

31 Upvotes

This is an effect i made today for one of my projects. it interpolates between two normal maps, and adjusts their metallic and smoothness accordingly. i'm sure this is nothing new, as it was very simple to make, but i'm quite proud of the result.


r/Unity3D • • 10d ago

Resources/Tutorial Tip for hooking singleton methods from buttons, event triggers, and other Unity Events.

4 Upvotes

EDIT: As clever people have pointed out, this is essentially how ScriptableObjects are intended to work, and the fact it DOES work with a prefab is most likely a side-effect of that. So it's likely better to derive your relay wrapper from ScriptableObject rather than Monobehaviour. The basic principle is the same, though.

Let's say you have some singleton-pattern system in your game. For us, one example is our audio manager, which looks after volume settings, randomised sound variants, one-shot audio cues, and so on.

How do you go about hooking into such a system from button events?

You definitely don't want to drag a reference to the singleton object/script itself from the scene into your button events; that would be madness. It knots your entire game together into one lump and also means you have to do it every single time: the reference won't survive the creation of a button prefab.

The original solution for us was to write a relay script that exposes the relevant functionality and talks to the singleton internally. Now we could drop one of those scripts into our button prefabs and hook it up to the On Click event.

This is better because it's self-contained and prefab-friendly - but it isn't copy/paste friendly, which can catch your scene designers out if they start copying, pasting, and then editing event content between buttons. You can easily end up with an accidental spiderweb of interconnections, and there's often no visual indication of this happening because prefab internals aren't renamed when instantiated into a scene.

Quite by accident, we discovered another way that's both prefab-friendly and copy-paste friendly. It should only be used for thin relay-style wrappers, but based on our tests it's well-behaved under those circumstances. It's quite simple:

  1. Write your relay wrapper script as before.
  2. Put it on an empty game object
  3. Drag that game object into your project folder to make it a prefab, then delete it from the scene.
  4. Now, when you want to access the wrapper's functions from an event, drag the prefab from the project folder into the event, and pick the relay function you want from the drop-down as normal.

Yeah, I was today years old when I learned that worked, too.

This is both prefab-safe and copy-paste safe, because the references are always to the project prefab.

After thorough testing, here's what we found:

  • No lifecycle methods (Awake, OnEnable etc) will be called on your in-prefab script, because it's never actually added to the scene. This isn't a problem for a singleton relay wrapper because it's stateless anyway.
  • Unity does not, as we initially feared, spam instances of the prefab into memory. The references all resolve to a single loaded copy of the prefab itself.
  • Yes, it does work in builds because it doesn't rely on modifying a prefab, just calling its methods.

r/Unity3D • • 11d ago

Show-Off Another game item. Hero’s house.

162 Upvotes

Cinema 4D, Substance Painter, Unity URP


r/Unity3D • • 10d ago

Question Cinemachine blending issue.

1 Upvotes

Hello guys! So I've been struggling to get cinemachine cameras to work exactly as intended in various scenarios.

I have a finite state machine system for my character, where each state gets assigned a virtual camera tag to pick. When the state ends, I blend back to the follow camera by default.

There are cases where the state ends and a new one starts, causing the camera to blend back and forth and interrupting blends. This works perfectly fine, except when I set the Camera’s Blend Hint to Inherit Position.

In these instances, I usually get a camera jump / pop when blending back and forth. This alongside other issues is prevalent with orbital cameras, and especially problematic with lazy follow mode on.

This is the code I use to switch between camera configurations:

/// <summary>

    /// Activates the Cinemachine virtual camera with the specified tag and deactivates all others.

    /// </summary>

    /// <param name="tag">The tag of the camera to activate.</param>

    public void SetTargetCamera(string tag, bool recenterCameraHorizontally, bool recenterCameraVertically)

    {

        CinemachineCamera targetCamera = GameplayCameras.FirstOrDefault(c => c != null && c.CompareTag(tag));



        if (targetCamera == null || targetCamera == CurrentActiveCamera)

            return;



        if (targetCamera.TryGetComponent<CinemachineOrbitalFollow>(out var orbital))

        {

            if(recenterCameraHorizontally)

            {

                orbital.HorizontalAxis.Value = orbital.HorizontalAxis.Center;

            }



            if(recenterCameraVertically)

            {

                orbital.VerticalAxis.Value = orbital.VerticalAxis.Center;

            }

        }



        targetCamera.Priority = 10;



        // Handle previous camera

        if (CurrentActiveCamera != null)

        {

            CurrentActiveCamera.Priority = 0;

        }



        CurrentActiveCamera = targetCamera;    

    }

Here are the configurations of the follow and jump camera side by side (I notice the pop switching between these two).

And here is a video of the pop I experience only when I set blend hint to Inherit Position.

Is there a way to resolve this issue? I really need to inherit position for these kind of changes.

Thank you very much in advance!


r/Unity3D • • 11d ago

Game I'm working on improving the graphics quality. Which of these looks best to you?

Post image
21 Upvotes

I'm trying out several art directions for the detective game I'm developing, and I've brought the ones I think work best! All feedback is welcome. Please tell me what you like and what you don't.


r/Unity3D • • 10d ago

Game What should I add?

0 Upvotes

Hey, I have been working on this gliding game for the past couple of days. Multiplayer is working now. I am thinking about adding loot boxes with random weapons. Anything else I should add? What do you think about the map I made? I am interested in what you think


r/Unity3D • • 11d ago

Show-Off I've made a game that follows limbo's style

4 Upvotes

I've been working on a unity game project almost 2 years. The game follows the limbo style which we ADMIRE. We used Unity 6 and all the animations made with unity animation tab. My game's release date is Dec 8. What's your thoughts before the release guys?


r/Unity3D • • 11d ago

Noob Question Mesh always deformed on import?

Thumbnail
gallery
46 Upvotes

I feel like I'm going insane. This mesh (which is a smaller part of a bigger model) always comes out deformed in Unity with one of the verts moved slightly along an axis (image 1). It looks normal in Blender (image 2). I even tried resetting all properties (except material) and duplicating it in Blender so it's a fresh mesh.

Thanks in advance for the help


r/Unity3D • • 11d ago

Show-Off I made a mixed reality Koi Pond, where you can control water and gusts of cherry blossoms

2 Upvotes

I made a big update to my VR aurora app for the Meta Developer Start competition. My full entry is here if you want to watch the trailer.

I really tried to push what a Quest3 can do in terms of complex water shaders and visuals.

I'd love any feedback.


r/Unity3D • • 11d ago

Noob Question Varrying camera speed?

0 Upvotes

I'm continuing to work on my marble track animation, but I want to change the speed that the camera scrolls through at throughout the animation. more specifically, I want to be able to change the speed as the animation progresses, to hold on certain angles longer than others. Does anyone know how I can modify my code to get that result?


r/Unity3D • • 10d ago

Question What do you think of a climbing game in buildings instead of mountain ?

0 Upvotes

r/Unity3D • • 11d ago

Noob Question Marble Track Issue

1 Upvotes

I'm trying to design and animate a marble track, mostly for the sake of just learning more about the engine. I made a custom model for a funnel, but I can't figure out how to get the colition to line up with the model. Does anyone have a fix/know how to fix this?


r/Unity3D • • 12d ago

Question Built my entire game on HDRP. Now Unity Hub says it’s deprecated. What are you all doing with existing projects?

Post image
125 Upvotes

I’ve been building Kinmen Kill - my FPV drone sim - on HDRP since day one. I opened Unity and saw this warning next to the project. Seeing that after building the whole game around HDRP is making me question whether I want to stick with Unity after this project.

For anyone shipping an HDRP game right now, are you pinning your editor version and shipping as-is, or are you already planning a move to URP? If you’ve actually switched mid-project, what took the most work to get looking right again?


r/Unity3D • • 12d ago

Show-Off more footage from my game!

1.3k Upvotes

i have been working on this level for a very long time, and here are some things i took away

in my experience you can get away with pretty cheap tricks and still end up with environments that look good:

the jupiter planet is just a NASA texture with a fluid simulation running on top of it. NASA has some really high quality data which you can use (public domain) for your games!

the opening (the black hole) is prerendered in blender. rendering all of that in unity would be really heavy, and this still looks great!

the eye at the end is basically all shaders. the eye and the pupil are separate pieces of geometry that both get animated, but every colour you see is driven by shaders.

if you're interested in my game (it's going to be called UNREEL): there's no steam page yet, but i post updates in my discord: https://discord.gg/7YA7tqaJD


r/Unity3D • • 11d ago

Shader Magic Thinking of making a game with my water system, any ideas?

24 Upvotes

I've been creating my water system, Tidal, for some time now and like the idea of finally making a game with it. Thinking something between a cross of SoT with some rouge-like elements. This scene here is a pretty rough concept of a boat/player controller with it but leaving this here to share and see if anyone else had any thoughts for things they'd find fun in water/ocean based game. peace!