Discover and read the best of Twitter Threads about #unitytips

Most recents (24)

#unitytips Let's talk singletons. Love or hate them, they're an extremely common pattern in Unity gamesโ€”for good reason. The engine itself even has some built-in! (kinda)

However, I often see developers implement the pattern in very error-prone or overly-complex ways.

(thread)
Consider the following example. It is representative of what you will typically see in tutorials and various other educational resources for Unity: Image
Simple as it may be, this has a number of glaring issues:

โ€ข If a singleton needs to access another singleton, it cannot reliably do so in Awake.
โ€ข The component needs to be manually placed in every scene.
โ€ข You need to manually implement the pattern for every singleton.
Read 26 tweets
Hey #IndieDevHour! ๐Ÿ‘‹

Today I added dithering to the Pixel-Light ๐Ÿ’ก shader for #BoneToPix

Mini-tutorial below ๐Ÿ‘‡๐Ÿงต

#GameDev #IndieDev #PixelArt #UnityTips
Previous thread with the start of the tutorial for per-texel cell lighting:

The main trick for this one is doing a 1:1 mapping of texels in our main texture to texels in the dithering lookup

Then bring it into the [-1,1] range and scale it.
The sampled offset is used in the CellLookup

Make sure your dithering lookup is set to wrapped for this to work Image
Read 4 tweets
๐Ÿ”ฝHow I made this cool "LED panel" effect in Unity
โš ๏ธDisclaimer: I have no idea what I'm actually doing

#madewithunity #unitytips #shader #vfx #unity
Now, the easiest way of doing this would be with a simple scrolling texture. However, if you need many different messages, you need many different textures, and file size can be a problem if you are targeting mobile platforms (which I'm doing)
So instead, I'm only going to use one "high res" mask texture, and keep all the other ones with a really small resolution, which scales better the more textures you need (I think that makes sense?)
Read 9 tweets
๐Ÿ“ฆLetโ€™s start with some of my favorite / recommended Unity packages! These are all instant-installs for me when setting up a new project, and provide plenty of use for whatever you might decide to work on!

Letโ€™s dive in! (threadโฌ‡๏ธ)
- @artofsully #unitytips
@artofsully ๐Ÿ“‚QHierarchy
Say goodbye to the boring default hierarchy and say hello to QHierarchy! Adjust colours for better visibility of groups, show more information through icons and text, and much more!๐ŸŒˆ
@artofsully โœจAMPLIFY SHADER EDITOR
@AmplifyCreates is my go-to shader editor for Unity! It's super intuitive and has excellent online documentation for everything you'd want to know.
BONUS: There's a whole collection of example shaders included to use and learn from!๐Ÿคฉ
Read 5 tweets
Hello Unity fam!๐Ÿ‘‹
My name is Fabian Willis (@FabianWillisArt), 3D Artist from Atlanta, and I will be your flight attendant on behalf of #Unity3D Airlines. Please ensure your electronic devices are not set to airplane mode as Iโ€™ll be sharing some #unitytips & tricks with you ๐Ÿงต
Some info about me:
๐Ÿ“ŒBeen learning 3D w/ Blender since 2018 & Unity gamedev since 2019
๐Ÿ“ŒMy art evolved from flat creations to low poly cel shaded characters & enviro design
๐Ÿ“ŒMy inspo comes from games Iโ€™ve played in my childhood: Zelda, Kingdom Hearts & Final Fantasy 9 & 10
.@HofmannDev & I (@FabianWillisArt) are working on a game like classics Jak & Daxter, Wind Waker, & Majoraโ€™s Mask. It features a main character called Demi, has a compelling plot, the gameplay of an action-adventure, & the mechanics of a 3D platformer๐Ÿ‘‡
twitch.tv/incarne
Read 5 tweets
Happy #unitytips Tuesday! Thought I'd share a ๐Ÿงต on something that should be super helpful for VFX artists!

It's about that "BlendAdd" blending mode, discussed at the famous Diablo VFX talk โœจ

Let's go~



#gamedev #unity3d
With Unity's "Standard Unlit" particles you have a "Rendering Mode" dropdown that gives you the options you can see below. Most of them are easy to guess what they do, but "Fade" and "Transparent" don't really communicate their differences.
It also doesn't help that the standard object shader also has these modes but act different; "Fade" completely fades the object away when alpha is 0, while "Transparent" keeps specular reflections when alpha is 0. That's not the case with unlit particles though (obvs)
Read 10 tweets
Sup Friends! Lets do some Editor Scripting! theres a whole bunch of cool tech unity have added over the last year or so thats SO worth knowing about. Lets buildsomething with...

- [SerializeReference]
- TypeCache
- SerializedObjects
- ReorderableArrays

exciting! #UnityTips
So heres the dream. We want to have a list of *things* that we can assign in the editor, and then at runtime we want to iterate though that list and do some *stuff*. its a simple idea! but untill recently, its been HELLA hard to implement something like this in unity!!
So lets look at the first part of that problem. we want a list of stuff! and stuff to go in the list! and a (hacky) way to get stuff in the list!

So, what we have here is simple, we got a MonoBehvaiour that has a List of KindOfStuff objects in it.
Read 17 tweets
Let's talk about @unity3d, and the execution order of its event functionsโ€”such as ๐š‚๐š๐šŠ๐š›๐š and ๐š„๐š™๐š๐šŠ๐š๐šŽ.

Trust me when I say that ...IT'S WAY MORE COMPLICATED THAN YOU THINK. ๐Ÿ˜ฌ

#gamedev #unitytips #madewithunity

๐Ÿงต๐Ÿ‘‡
๐Ÿ”น๐—™๐—ถ๐—ฟ๐˜€๐˜ ๐—ฆ๐—ฐ๐—ฒ๐—ป๐—ฒ ๐—น๐—ผ๐—ฎ๐—ฑ

1โƒฃ ๐™ฐ๐š ๐šŠ๐š”๐šŽ: always called before any ๐š‚๐š๐šŠ๐š›๐š & after a prefab is instantiated

2โƒฃ ๐™พ๐š—๐™ด๐š—๐šŠ๐š‹๐š•๐šŽ: called just after a ๐™ถ๐šŠ๐š–๐šŽ๐™พ๐š‹๐š“๐šŽ๐šŒ๐š is enabled (including when loaded, created, or a ๐™ผ๐š˜๐š—๐š˜๐™ฑ๐šŽ๐š‘๐šŠ๐šŸ๐š’๐š˜๐šž๐š› script is added)
๐Ÿ”น๐—•๐—ฒ๐—ณ๐—ผ๐—ฟ๐—ฒ ๐˜๐—ต๐—ฒ ๐—ณ๐—ถ๐—ฟ๐˜€๐˜ ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ ๐˜‚๐—ฝ๐—ฑ๐—ฎ๐˜๐—ฒ

3โƒฃ ๐š‚๐š๐šŠ๐š›๐š: called before the first frame update. This happens only if the script is enabled. ๐š‚๐š๐šŠ๐š›๐š can also be made into a coroutine by changing its return type to ๐™ธ๐™ด๐š—๐šž๐š–๐šŽ๐š›๐šŠ๐š๐š˜๐š›
Read 13 tweets
Sup Friends! lets build an editor tool together, we haven't done that in AGES! I need to preview a Texture2D in the inspector, and theres no easy way to do it without making a custom editor. Lets fix that by making a PropertyDrawer! Its going to look like this #UnityTips
If you dont know, Property Drawers let us customize the inspector by adding a Attribute tag onto a property. As an example, lets add a Range drawer onto the Face index in my example code. Range is built into unity and is a good demo of the power we get from PropertyDrawers~
So lets make our own! The goal is to make the texture thats assigned to the SelectedFace property draw in the inspector. We need to make a new PropertyAttribute that triggers the editor to draw the texture field exactly how we want.. Lets add one called TexturePreviewAttribute! ImageImage
Read 18 tweets
After using @unity3d for almost 10 years, I want to share the TEN small features that are really helping me develop games faster.

Starting with my favourite... ๐Ÿ˜Ž

1โƒฃ Inspector Maths

You can write ACTUAL mathematical expressions in the inspector! ๐Ÿคฏ

Check the other ones!

๐Ÿงต๐Ÿ‘‡
2โƒฃ Animation Curves

Unity supports a super easy way to create smooth paths through ANIMATION CURVES. Perfect for blending & animating properties.

Creation:
public AnimationCurve Curve;

Usage:
float x = Curve.Evaluate(t);

#unitytips

docs.unity3d.com/ScriptReferencโ€ฆ
3โƒฃ Gradients

The equivalent of AnimationCurve for colours is Gradient. You can use it to create and sample smooth gradients.

Creation:
public Gradient Gradient;

Usage:
Color c = Gradient.Evaluate(t);

#unitytips

docs.unity3d.com/ScriptReferencโ€ฆ
Read 10 tweets
Unity NavMeshes! We've recently switched to them from our old custom A* pathfinding solution, and we've found it super fast, robust and accurate. Here's a few #UnityTips to help you make the most out of the NavMesh API
(thread)
#madewithunity
NavMeshAgents are great to get something working quickly, but they're a bit limited & prescriptive when dealing with finely tuned movement & steering. Instead, we use CalculatePath, passing the result to our own character controllers. No agents necessary!
docs.unity3d.com/ScriptReferencโ€ฆ
Consider using NavMesh.SamplePosition instead of just passing your source and destination positions directly! This way our AI can create a best effort path even if the player or enemy positions aren't directly sitting on the NavMesh itself
Read 6 tweets
We celebrate that dance is a place where people of different backgrounds can come together around a common love for self expression through movement. But we are watching our dance communities crumble under the divisive ideology of critical theory/identity politics.
There are still racial injustices in the world. We believe that the best way to fight them is to work together as a community and as equals, regardless of skin color, sex, sexual orientation, gender, etc.
We see the racism happening in the classic sense, but we also see the racism happening within woke ideology and we are standing apart from it.
Read 13 tweets
Thread about personal #unity packages: I think I've converted most of my Unity stuff now to packages. It's pretty neat, and super easy to reuse, and there's just one copy of each per project. Of course, you need to make sure it works in every project #unitytips (1/?)
So, basically how to convert your code to package: first, you need to have your code isolated with an asmdef. If your code is super-cross-referenced with everything else this might be a headache to make it work. Basically you need to reference everything you are using..
It's suggested that you should name your packages YourName.YourPackage, so that's what I'll do. And we immediately have an error because one of my scripts is using Unity.Mathematics. You need to add it to the asmdef.
Read 22 tweets
Started using VS Code for Unity a week ago now, here's a little review thread of my first impressions compared to Visual Studio #unitytips #vscode Image
VSC is lighter and starts much faster, which is always a good thing. It does download a lot of additional stuff for C# functionality once you start using it, but at least it's not 8+ gb like VS
Unity's VS Code support comes in a package, and I've had some issues with it.. And apparently it happens that VSC support gets broken from time to time
Read 14 tweets
Wanted to make a comparison between Burst-CPU and GPU performance so made a little Mandelbrot explorer. Turns out it's very nice as well. Try it for yourself: github.com/nothke/Jobifieโ€ฆ #gamedev #madewithunity #shaders
Spoilers: GPU is much faster :P

Interesting find: I see almost no perf difference between float and double precision on CPU, while on GPU it's big. I would guess it's maybe to do with the sheer amount of data which overshadows the cost of operations themselves..?
Also note that CPU mode is locked to 1024x1024 texture while GPU works per pixel so depends on your screen size. I should fix that.
Read 4 tweets
Oh great my first 4k likes tweet and it's a rant ๐Ÿ˜ฌ First check out my games nothke.itch.io (new game coming tonight!). Second, I want to say that this was about analysis paralysis because of all the choice and I want to address people who seem to think Unity is crap 1/2
2/2 Unity is WAY better than it was in 2016. You can make great games, esp indie (LTS releases are ๐Ÿ‘Œ). If you use stable packages and use built-in graphics pipeline you are good. But, if you want to push the envelope with newest tech that's where you'll stumble upon many hurdles
Read 4 tweets
I ported Recompile's hologram shader over to HDRP Shader Graph!
Also added a couple of new features & improvements...
Here's how it works (see graphs in thread)
#madewithunity #gamedev #unitytips
It's basically a transparent lit shader with two layered screen space scanlines, fresnel glow, flicker, and some glitchy, wibbly wobbly vertex extrusion thing
For the scanlines, we simply scale the screen UVs and use the fraction node to get a gradient for each line. No textures required! We also animate/pan this along the Y axis
Read 5 tweets
Let's talk about tweening curves! These curves are amazing, I use them all the time and I've built myself a set of tools to access them everywhere. Here's a thread about CURVES. ๐Ÿ‘‡

#madewithunity #gamedev #unitytips
A few days ago, @wilnyl posted a great tweet about animation curves and that reminded me that I never shared that tween cheat sheet I created a while back.

You can check it out (on desktop) at moremountains.com/assets/resourcโ€ฆ
The word "tween" comes from the frames "between" key frames in traditional animation, and we can use tweens to update values over time in interesting ways. Position instantly comes to mind, but you can alter opacity, lights, or even timescale with tweens.
Read 18 tweets
Since a few people have asked me about the UI in #INFINLAND & #TCIBTTCT, I've put it up on github as package. It's an IMGUI wrapper with easy toolbar/window management for debugging/prototyping and a few useful extensions: github.com/nothke/ProtoGUI #madewithunity #unitytips
Note that since it's IMGUI, it's not too good on the performance side, it GC allocs a lot and with too many elements (especially text) can be quite slow. It's primary goal is to be easy to use.
Now I'm waiting (and you should too!) for the promising UIElements from Unity that will solve all our UI performance and usage issues :)
Read 3 tweets
Hey, you can actually render a mesh directly to a RenderTexture without a camera, if you don't need the fancy camera bits like culling, shadows n stuff. Here's how, annotated: gist.github.com/nothke/e521448โ€ฆ #unitytips #madewithunity
I'm so happy to discover this because in #HDRP, rendering a single cube using a separate camera takes a whopping 2+ms (on my PC ofc), even with ALL features off (except opaque rendering), because of all the other camera-related processes going on in the background. Image
For comparison the "direct" blit takes just ~0.03ms. Using multiple cameras is just insanely inefficient for simple things like this. Image
Read 3 tweets
๐Ÿ“Lerp vs Slerpโญ•

โ€ข Lerp interpolates in a straight line
โ€ข useful for interpolating positions

โ€ข Slerp rotates around (0,0)
โ€ข useful for interpolating directions

#unitytips
"But can't I just use lerp and normalize instead of slerp?"

for small angles, it might be good enough, but for large angles, their directions actually deviate quite a lot

here they are superimposed!
here's a bonus comparison between:

๐Ÿ’™ = Vector Lerp
๐Ÿ’œ = Vector/Quaternion Slerp
โค๏ธ = Quaternion Lerp

(oh hey accidentally matched colors to #BiVisibilityDay ๐ŸŽ‰)

also included the normalized version of vector lerp in faded blue!
Read 3 tweets
A quick guide to Lerp~โœจ

Lerp is used to blend between two things!

It has three inputs: ( a, b, t )
a = start value
b = end value
t = how far we should go from start to end, as a percentage

Here it is in action!โšกblending a value, position, color and an angle!
If you're using Unity - make sure you use the Lerp appropriate for your use-case!

Mahtf.Lerp - values
Mathf.LerpAngle - angles
Color.Lerp - colors
Vector#.Lerp - positions
Vector#.Slerp - directions
Quaternion.Slerp - rotations

#unitytips
here's how to lerp mathematically!

a(1-t) + bt
weighted sum interpretation, where both contribute a total of 1, trading off influence

a + t(b-a)
this one originates from a, moving toward b by adding the displacement scaled by t

oh, and, these two are mathematically equivalent!
Read 7 tweets
Finally added alpha dithering to our particle shaders! @Skepsisology has been requesting this for ages.
We use it for 2 things: fading out smoke that's too close to the camera, and fading out smoke over lifetime.
Here's how we did it (THREAD):
#gamedev #unitytips #madewithunity
Btw here's the YouTube version that doesn't suffer from Twitter's video compression so you can see the effect clearly (2/9)
Firstly, fading out particles close to the camera. In the vert function we get the distance between the world space vertex and the camera position, and normalize that with our desired dithering distance (3/9)
Read 9 tweets
Weโ€™re trying something different for this weekโ€™s #unitytips Tuesday! In this thread, the design team gives you some insight into the process behind a great Unity 2019.1 addition, Shortcut Manager.
It all starts with an idea - and this one was about making hotkeys more accessible. How can we make it easier to assign, manage, debug, and understand all your hotkeys in Unity?
Once weโ€™ve explored the concept a bit and done some sketches, out come the wireframes. Weโ€™ve got some old-school designers that still like to use @Balsamiq for interaction callouts, states, and rapid iterations.
Read 7 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!