For some reason the script fails after printing out "2". I tried using getters and setters but it didn't work (unless I used them incorrectly since I don't know much about them). Any ideas what's wrong?

I’ll add some answers to this post for anyone else actually looking for them.

1) Possible you didn’t add the fading script to the object, therefore it isn’t returning the correct object.

2) This appears to be the Fading script, which means that you don’t need to use GetComponent(), and can just access the variable FadeOut directly.

3) Another thing here, in the case that these were 2 different scripts, would be that the FadeOut variable is private and not accessible from the script you’re in. Though, in that case you’d get a compiler error, and couldn’t run anyways. [SerializeField] is used to show the variable in the editor (like how public variables can be seen), not to make them accessible to other scripts.

/r/Unity2D Thread Link - reddit.com