Forum rules - please read before posting.

NullReferenceException when opening inventory tab

Hi,
I am using AC version 1.52a and i got NullReferenceException after i checked in the Inventory tab the option: pass HotSpot as GameObject parameter.

This bug preventing me from entering inventory tab.
please assist ASAP

Comments

  • Try defining an Unhandled "Use" interaction at the top of your Inventory Manager.  It can just be an empty ActionList asset if need be.

    If that doesn't improve things, you will have to post the error message in full in order for help to be given.  That it is a NRE error alone is not enough to provide full assistance.


  • Hi ChrislceBox,

    Thanks for your answer, when i choose Inventory Manager it does not display anything
    except this error message: 

    NullReferenceException: Object reference not set to an instance of an object
    AC.InventoryManager.ItemsGUI () (at Assets/AdventureCreator/Scripts/Managers/InventoryManager.cs:164)
    AC.InventoryManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/InventoryManager.cs:137)
    AC.AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:204)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

    when i am debugging it is stuck in ItemGUI() function on line 164:
    EditorGUILayout.HelpBox ("The Hotspot will be set as " + unhandledHotspot.name + "'s first parameter, which must be set to type 'GameObject'.", MessageType.Info);

    i see that unhandledHotspot variable is equal to null

  • edited August 2016
    Expect an official fix in v1.53, but in the meantime you can remove that line to fix the problem.
  • You are trying to use something that is null . This means you either set it to null, or you never set it to anything at all.

    Like anything else, null gets passed around. If it is null in method "A", it could be that method "B" passed a null to method "A".

    The rest of this article goes into more detail and shows mistakes that many programmers often make which can lead to a NullReferenceException.

  • A mistake I've made in AC more than once, unfortunately, but hopefully understandable given its size.  However, I'm swift to correct them when informed, and the one mentioned in this particular thread is now fixed.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.