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...
Inspector Maths
You can write ACTUAL mathematical expressions in the inspector!
Check the other ones!
Starting with my favourite...
Inspector Maths
You can write ACTUAL mathematical expressions in the inspector!
Check the other ones!
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
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
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
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
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
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
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
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
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
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
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
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
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/
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/
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
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
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