Quantcast
Channel: Latest Questions by Zexanima
Viewing all articles
Browse latest Browse all 12

What is the reason for this NullReferenceException?

$
0
0
None of my other Objects seem to be able to reference the script ItemManager, every time I call for a static variable from it, it returns null. World - ![World][1] Player - ![alt text][2] Here is the first (of many) places I get the error: NullReferenceException: Object reference not set to an instance of an object Inventory.Start () (at Assets/Scripts/Player/Inventory.cs:58 Line58: ItemSlot temp = new ItemSlot(ItemManager.EMPTY.ShallowCopy()); I think it has to do with the static variable EMPTY, however I believe I have it setup correctly: public static Item EMPTY; public static Item STONE; public static Item GRASS; public static Item BRICK; //************************************ // Use this for initialization void Start () { Debug.Log ("Initalized"); guiCon = gameObject.GetComponent ("GUIController") as GUIController; soundMan = gameObject.GetComponent ("SoundManager") as SoundManager; // *** Set new *** // *** Initialize Item *** EMPTY = new Item("", 0 , 64, new Rect(0.25f,0.75f, 0.25f,0.25f), itemIcons, Item.ItemType.Empty,"DefaultItem"); // MORE CODE AFTER... [1]: /storage/temp/24535-ss+(2014-03-30+at+06.09.45).png [2]: /storage/temp/24536-ss+(2014-03-30+at+06.11.40).png

Viewing all articles
Browse latest Browse all 12

Trending Articles



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