Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Wrong use od if & else!?

$
0
0
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"){

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>