There are 4 comments:

  1. When I sleep twice, my cabbage state changes to Harvestable, and I get an array index error when I go from home to farm.

  2. 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. Required fields are marked *

Note: You can use Markdown to format your comments.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.

This site uses Akismet to reduce spam. Learn how your comment data is processed.