When I get a nullpointer exception it can be really frustrating, because usually there are multiple variables referenced on one line. So I was wondering if there are any way to make unity tell me the name of what variable causes the nullpointer?
You must use debugger in this case - MonoDevelop or Visual Studio (+Visual Studio tools for Unity), there you can enable exceptions on which the debugger should break, you’ll be able to see then what variable is null.
Is this really the best option? I remember when getting a null pointer in GameMaker (At leat back when I used it) it would say something like: ‘Nullpointer exception, variable ‘foobar’ is null’, which made it really fast and nice to debug. Is there really no option to do something like this with Unity?
Sadly NullReferenceException doesn’t contain this information, so attaching the debugger is the best option here. See more here - NullReferenceException Class (System) | Microsoft Learn
Thank you very much for your help ^^