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

https://docs.unity3d.com/ScriptReference/AnimationCurve.html
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

https://docs.unity3d.com/ScriptReference/Gradient.html
4⃣ Multi-Object Editing

In Unity, you can select multiple objects and change their properties together.

If a field shows a "—", it means that the selected objects have different values.

For custom editor inspectors, have a look at [CanEditMultipleObjects].

#unitytips
5⃣ Vertex Snapping

In Unity you can hold [V] to select and snap to vertex.

This is very helpful to make sure two objects are *really* next to each other.

#unitytips
6⃣ Inspector Headers

In Unity, you can use [Header("x")] to create (guess!) a header in the inspector.

This works for shader code as well—although you need to remove the ".

Another helpful attribute is [Space]. Also use it as [Space(10)].

#unitytips

https://docs.unity3d.com/ScriptReference/SpaceAttribute.html
7⃣ Start as a Coroutine

In Unity, you can convert the Start function into a coroutine.

Before:
void Start () { ... }

After:
IEnumerator Start () { ... }

This trick also works with OnCollision— & OnTrigger— methods.

#unitytips
8⃣ Wait for a coroutine

If you use coroutines, you might be familiar with stuff like:
yield return new WaitForSeconds(1f);

In Unity, you can actually wait for another coroutine to end:
yield return StartCoroutine(MyCoroutine());

#unitytips https://www.alanzucconi.com/2017/02/15/nested-coroutines-in-unity/
9⃣ Pause on Error

If you can enable the "Error Pause" option in the Console windows, Unity will automatically pause every time there is an error.

This can be super helpful for debugging purposes!

#unitytips
🔟 Lerping between Materials

In Unity, you can "blend" between two different materials using Material.Lerp.

This will lerp all properties with the same name.

Usage:
renderer.material.Lerp(material1, material2, t);

#unitytips

https://docs.unity3d.com/ScriptReference/Material.Lerp.html
You can follow @AlanZucconi.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.