Object reference not set to an instance of an object

Discussion and help for Easy Save 3
Post Reply
ariza8627
Posts: 16
Joined: Sun Jul 07, 2019 8:06 pm

Object reference not set to an instance of an object

Post by ariza8627 »

Hi! So i'm having trouble with the saving and loading function and I hate to admit this but as i'm only a hopeful up and coming comp programmer, i need to ask for some help.
So in one of my my scripts, I have a function called saveTheGame. This script contains statements such as "ES2.Save(_BaseStats.playerHealth, "playerHP");", "ES2.Save(_BaseStats.currentLevel, "currentLevel");", and "ES2.Save(_BaseStats.currentEnemyWeapon, "currentEnemyWeapon");", etc.
In that same script I have a function named continueGame. This script contains statements such as "_BaseStats.playerHealth = ES2.Load <int>("playerHP");" and "_BaseStats.currentLevel = ES2.Load<string>("currentLevel");", etc.
I understand why things would be null when I havent yet used them but I initialize them with a value even if the value is equivalent to zero it isn't null, so like I dont understand...
I have no code checking to make sure the value has been initialized although I have a script named _BaseStats with all values initialized to their default value and I can see no reason why the variables could return a nullPointerException so that isn't the error. I created an empty GameObject and attached the _BaseStats script to it and then attached that same GameObject to the Easy Save 3 Manager GameObject but it's still giving me the error, "NullReferenceException: Object reference not set to an instance of an object ES3Settings.GetDefaultSettings () (at Assets/Plugins/Easy Save 3/Scripts/Settings/ES3Settings.cs:219)" as well as the error, "Could not find ES3 Default Settings object in Easy Save 3/Resources/ES3.UnityEngine.Debug:LogError(Object)".
I won't argue against being dumb because I just don't understand that. Any tips/guidance?
I am unfamiliar with asking for help in general so if there is something more that you need in order to assist me, I can supply whatever I have not already.
~ashenAlex
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Object reference not set to an instance of an object

Post by Joel »

Hi there,

The code you have posted is for ES2, but the error you have posted is for Easy Save 3. Please could you check there is no Easy Save 3 code in your project?

Also I recommend reimporting Easy Save from the Asset Store, and right-clicking the Assets/Plugins/ folder and pressing 'Reimport', as the error suggests that there is no reference to the ES3DefaultSettings object in Resources.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
ariza8627
Posts: 16
Joined: Sun Jul 07, 2019 8:06 pm

Re: Object reference not set to an instance of an object

Post by ariza8627 »

Is there a tutorial I can watch to get familiar with all of this because I can't find any on Easy Save 3 online.
Sorry for my confusion, I just followed what I learned from the video I found on YouTube.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Object reference not set to an instance of an object

Post by Joel »

Hi there,

We have a list of Guides here, and the Getting Started guide should give you most of the information you need to know.

If you want more information on the errors above, I'm not sure how to provide more information on this. If you want to PM me a very basic project and instructions to replicate it then that would be great.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply