Impatience is bad when coding, examine your code thoroughly

I don’t even know what to say

Code that I’m running:

void Update()
    {
        Debug.Log($"empty script reference is null: {test == null}");
        Debug.Log($"camera reference is null: {activeCamera == null}");
        Debug.Log($"camera controller reference is null: {cameraController == null}");
}

empty script and camera controller (SimpleCameraController from urp preset) malfunction, while Camera scrtipt works as expected.
In the video, all references are set through editor, though I tested this setup with GetComponent() and it produces exact same result.
I ran this on Linux (Fedora 36).
I assume that it has something to do with the fact that both SimpleCameraController and my empty script are both in the same assebly, while the Camera is in a different one, but I don’t know neither why this happens, nor how to fix it.

Sounds like you’re trying to bypass the three-step process!

How to fix a NullReferenceException error

https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/

Steps to success:

  • Identify what is null
  • Identify why it is null
  • Fix that

Do you have two of these script instances and one is incorrectly set up?

Either way, the three steps above always work. Always.