In my limited experience, “failure” happens every time I write code.
But it’s not an end. Every time a bug/error pops up, it’s just another chance to learn something new! It might take hours, but I’ll end up with more knowledge thanks to my code not working, than I might have learned if it did.
I think it’s crucial to remember also that we in 2020 have a magical resource that programmers for the first 3ish decades of modern computing could have only dreamed of… GOOGLE!
Aside from being able to ask a question here or in other forums, looking at the Unity documentation, etc., I’ve found that just googling a problem or error code like “Unity NullReferenceException” is often the best way to quickly resolve a problem.
Most of all, KEEP CODING!