I have the problem, that my if statement causes trouble.
Here is the code asking for a statement:
if ("Meat" in ContentName){
if (ItemScript.ItemCondition == "raw"){
this.gameObject.GetComponent(ItemDefinition).ItemIcon = Meat_raw;
} else
if (ItemScript.ItemCondition == "cooked"){
this.gameObject.GetComponent(ItemDefinition).ItemIcon = Meat_cooked;
}
}
Now i get the errormessage: "NullReferenceException: Object reference not set to an instance of an object" when ItemScript.ItemCondition == "cooked".
The error is in the line: if (ItemScript.ItemCondition == "raw"){
↧