nullreferenceexception
//Bug with VS: Exception e == null
//Happens when multiple catch variables are the same
//an example of the solution:
try
{
// do something
}
catch (WebException webEx) // using a variable named 'webEx' for this catch
{
Logger.Log("Error while tried to do something. Error: " + webEx.Message); // <-
}
catch (Exception ex) // using a DIFFERENT variable for this one
{
Logger.Log("Error while tried to do something. Error: " + ex.Message);
}
4
4
string foo = null;
foo.ToUpper();
Thank you!
4
0
3
1
// to change a variable from another script, just use this code with 1 being the
//GameObject that the script is on, 2 being the script, and 3 being the variable
GameObject.Find("1").GetComponent<2>().3 = whatever you want to change it to; ;
Thank you!
1
0
Are there any code examples left?
New code examples in category Other