Page 1 of 1

ES2Init and null string variable?

Posted: Fri Nov 25, 2016 3:33 am
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()
-----------------

Re: ES2Init and null string variable?

Posted: Fri Nov 25, 2016 8:30 am
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