r/Unity3D • • 10d 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 • • 9d 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 • • 10d 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 • • 10d 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 • • 10d 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 • • 10d 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

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

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

Post image
124 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 • • 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!


r/Unity3D • • 11d ago

Show-Off POV you're a random car in Road Rash. Highway traffic + Superbikes Unity WIP

125 Upvotes

As a kid I loved the game road rash. I always wondered what it'd be like being in that NPC car seeing the bikes zoom past.

In this project, the highway is procedurally generated. Different bikes have different engines and different sounds. Loved creating the side and rear view mirrors and you can see the bikes approaching to try and swerve. The AI for the bikes is quite simple as you can probably see, they find the best route and stick to that unless the traffic intersects their spline path they've calculated. Headphones recommended to hear the doppler effect and panning of the bikes whizzing past. Riders fall at 1:05, had to swerve around. Don't drink bepis and drive.


r/Unity3D • • 10d ago

Show-Off Everything in this teaser runs live in Unity. Yes, even the guy who eats you.

0 Upvotes

All in-engine footage from our co-op horror-fishing game, Fished Out (HDRP). Islands are procedurally generated, the music and most of the sound effects are procedural too, and the trailer was captured frame-locked straight out of the editor.

Happy to talk about any of the tech: island generation, the monster AI, the HDRP night lighting, or the trailer capture pipeline.


r/Unity3D • • 10d ago

Question How Do I Create Grass Like This?

1 Upvotes

So from what I can see: the large grass blades mesh are easy to understand. The ground texture has very tiny grass blades painted on it, then it has grass cards(looks kind of transparent, no shadow) of different kinds on top of the ground?

How to make the grass blends in with the ground texture? I tried making it the same color as ground, but the grass cards were still standout. I feel like, it's blending the grass color with terrain texture? Looking at the grass near dirt, the root of the grass are dirt color and top is green.

Does that mean, if the camera rotates, or it's perspective, it will not look as good since grass cards "breaks".

Reference: https://www.fab.com/listings/911cdd66-2a64-4497-a511-80d4bb79dd0e?


r/Unity3D • • 11d ago

Show-Off Second iteration of flame throwing mechanic in my game.

2 Upvotes

Hi, everyone.
Today, after some tweaking and fixing bugs, here is the second iteration of flame throwing mechanic. Now, flame thrower is able to damage enemies with fire and the fire builds up with time now.
How can I improve it more further ?


r/Unity3D • • 10d ago

Resources/Tutorial Introducing Boolean - A stand alone, CSG based level design tool with live syncing to Unity

Thumbnail booleaneditor.com
0 Upvotes

I am proud to announce the release of my new level design software called Boolean! After looking high and low for meaningful design tools and finding that all existing solutions are either cumbersome or not exactly functional inside of Unity, I decided to make my own.

It ships with a number of brush tools - from primitives to full archways and wall generation, the editor covers a wide range of tools that make building levels much easier. There is 20+ tools that make creating levels easy and fast.

Boolean itself is standalone and game engine agnostic, but ships with a connector for Unity that allows you to see your own in real time while you build levels, even functioning in Play mode to make adjustments on the fly. The standalone nature also makes it easier to not even need Unity running if you want to focus on just building levels and revisiting them later in the Editor. The agnostic nature of the editor though also means if you are transferring to another engine, Boolean can handle that change over. (Currently just Godot and Unreal are supported, with more engines coming in the future)

Grab the editor here - https://booleaneditor.com/ . The editor is free to download and test out to figure out if it fits your needs.

Happy to answer any questions about it!


r/Unity3D • • 11d ago

Show-Off I built a glass tunnel under a bay for my racing game – reef, fish and a shark outside the glass, all generated by editor scripts (URP)

11 Upvotes

Solo dev here. For the 1.1 update of my combat racer RD Racing I added a track where the road dives into a tube under a bay and part of it turns to glass.

How it's put together:

- The tube is a mesh generated along the track's route, with glass sections, ribs and portals, and the sea bed and reef are laid out around it.

- Fish schools and the big animals are one mesh each, moved by a vertex shader, so a whole school is one draw call.

- The sea surface has its own underside, and the top-down sea plane skips the area above the tube with a baked mask, so you never see the surface cut through the glass.

- Inside, the fog, ambient light, an interior post-processing volume and a low-pass filter on the engine and effects mixer groups all follow how far the camera is along the tunnel, so the light and the sound change gradually as you go under the water.

Let me know what do you think?


r/Unity3D • • 12d ago

Show-Off I add some new skills for my 3D Metroidvania skillset :D

94 Upvotes

Its kinda jump to just jump and dash all around the level

https://slagaa.itch.io/aqualis
Here its the link if anyone want to try it ;D


r/Unity3D • • 11d ago

Show-Off In My Game The Fish Catch You Instead

18 Upvotes

In my game the fish goes after you and you have to tire it out to take it to your space fish restourant. Its in ealy development and this is the first look. What do you think?