There are 2 comments:

  1. After completing this tutorial when I launch I get a unity pause with the issue –

    *NullReferenceException: Object reference not set to an instance of an object*
    In reference to this line – List landData = LandManager.farmData.Item1;

    Then when I un-pause unity it runs fine.

    1. Hi Corey, for Unity pausing on error, it’s because you enabled Error Pause in the Unity Editor: https://answers.unity.com/questions/737305/unity-pausing-when-runtime-error-occurs.html

      As for the NullReferenceException, whenever you get this, what you want to look at are at areas where you have a chain of full-stops (.), because what it is saying is that one of the objects you are referring to in the chain is null.

      In your case, it can mean that LandManager.farmData is null, or LandManager.farmData.Item1 is null. You can check if either item is null by doing a print before the line:

      print(LandManager.farmData);
      print(LandManager.farmData.Item1);

      Once you find which is the null item, ensure that it is filled and the error should go away.

Leave a Reply

Your email address will not be published.