ES2Init and null string variable?

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
leegod
Posts: 18
Joined: Sun Nov 20, 2016 10:42 am

ES2Init and null string variable?

Post by leegod »

1.
I found ES2Init prefab.
What is this for? All scene should have this come out?


2.
I have string variable, but when I try to save string variable that has no string value yet, null reference error occurs.

-------------
NullReferenceException: Object reference not set to an instance of an object
ES2Writer.Write[String] (System.String param)
ES2UserType_SubWindow.Write (System.Object obj, .ES2Writer writer) (at Assets/Easy Save 2/Types/ES2UserType_SubWindow.cs:21)
ES2Writer.Write[SubWindow] (.SubWindow param, .ES2Type type)
ES2Writer.Write[SubWindow] (.SubWindow param, System.String tag)
ES2.Save[SubWindow] (.SubWindow param, System.String identifier)
SaveScript.Save () (at Assets/Scripts/SaveScript.cs:40)
UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:153)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:634)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:769)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()
-----------------
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES2Init and null string variable?

Post by Joel »

Hi there,

The ES2Init is used internally and should not be placed into your scene.

Like Unity's Editor serialiser, it's not possible to serialise strings as null. Generally people initialise their strings to an empty string (i.e. "") to make them serialisable.

Also note that Easy Save 3 (which will be free to existing users) will be capable of storing values as null.

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