From the moment I first started making games (and prototypes... a lot of prototypes) in Unity, I've encountered many problems that have had me stumped, racking my brain for way too long, only to find that the problem was something so simple that I just overlooked (user error).
This list of stupid aims to fix that. Inspired by my lecturer Mark Thompson, this list of stupid lists all of the problems I've encountered that have made me feel stupid when I found the solution because of how trivial they were, beginning from June 12th, 2024. This list is specifically for answering problems found when working with Unity and C#.
If you are trying to change the AudioMixerGroup of an AudioSource using a public/serialised variable, make sure that variable has an AudioMixerGroup actually assigned to it in the Inspector.
You're looking for the wrong component. TextMeshProUGUI is a component that is only relevant to TextMeshPro UI text, as in the one on the canvas, whereas physical TextMeshPro objects in the 3D space instead have the TextMeshPro component. You should be calling for the component with GetComponent<TextMeshPro>().
If you're running a coroutine, even if your script is running a coroutine from another script, your original script has to always be active for as long as the coroutine runs. The script that holds the coroutine only stores it and doesn't run it independently when called from the original script.
If you are trying to call a Coroutine, make sure you call it as a Coroutine with StartCoroutine(CoroutineNameHere()); and not as a method with CoroutineNameHere();.
If you're doing an equation from within a Debug.Log function, make sure you wrap it in brackets
If your call for an Image component comes back with "Image is not a Unity Component", you forgot the UnityEngine.UI library. "Image" on its own is a class that already exists in C# outside of MonoBehaviour, which can cause confusion in the code.
If your code takes place over multiple frames, make sure the object that the script is attached to is not disabled halfway through it.
If you're calling a method from another script, make sure you state that the method is from that script, e.g. "Script2.MethodName();".