- You can check whether a Unity.Object (including Component, GameObject, MonoBehaviour, etc.) is null using
if (variableName), because it has an implicit bool operator that checks != null.
- If you’re trying to expose generic-typed properties in the inspector, you should constrain them with
where T : Component or similar, or strange things may happen when you check whether they’re assigned.
- I probably shouldn’t rely on generics so much. It’ll haunt me if I ever need to build for mobile or console.
Continue reading The Wrong Null!