Nothing worse than going to test your code only to be blue balled by a NullReferenceException. Diligence only getting you so far, and contributing unnecessary friction to your workflow.
Since Unity is essentially an over-featured GUI ref injector. We should expect its core service to be its best. As with all big projects, we/they must of gone blind to how big of an oversight this is.
Where in the case its not feasible, at least make it more noticeable in the inspector.
Unity got me back into development, so I owe it my honesty. thank you!
I may be doing it a brute force way, but if my code is expecting that a value in the inspector is already set, I check for a valid value, usually in Start. If there is no value, I log it to the console. In some cases, I might stick in an empty game object or other default value to keep later code from crashing while I’m working.
Some sort of marker on the hierarchy would be nice, though, just to help when wiring things up in the first place.
I use assertions in the Start method to detect when things that shouldn’t be null are. You should use conditional methods to do debugging checks like that in all your code, it’ll save you a lot of headaches down the line. Code behaving funny? -define:smile:EBUG
Thank you. I used that once in a tutorial to check number values or something, but I hadn’t even thought about using it for value existence. I will have to start doing that.