hi Joel,
thanks for your reply, but
https://docs.moodkie.com/easy-save-3/es ... hout-code/ is exactly the doc I used to understand how it works. For example the transform settings of my 3d objects are saved. But not the settings of my toggle and slider panels. So it seams my needed properties are not supported by default.
I tried a little bit around and found this doc
https://docs.moodkie.com/easy-save-3/es ... -es3types/ - so I used this to activate my needed properties:
* Toggle > Properties > isOn
* Slider > Properties > value
For the first run everything works now as expected. After that, my Toggle and Slider components are broken:
Code: Select all
NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.Toggle.Set (System.Boolean value, System.Boolean sendCallback) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:275)
UnityEngine.UI.Toggle.Set (System.Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:248)
UnityEngine.UI.Toggle.set_isOn (System.Boolean value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:242)
UnityEngine.UI.Toggle.InternalToggle () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:308)
UnityEngine.UI.Toggle.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Toggle.cs:319)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update()
The easy save types settings give me also the following hint:
Code: Select all
This type has no public parameterless constructors.
To support this type you will need to modify the ES3Type script to use a specific constructor instead of the parameterless constructor.
Code: Select all
using System;
using UnityEngine;
namespace ES3Types
{
[ES3PropertiesAttribute("toggleTransition", "graphic", "onValueChanged", "isOn")]
public class ES3Type_Toggle : ES3ComponentType
{
public static ES3Type Instance = null;
public ES3Type_Toggle() : base(typeof(UnityEngine.UI.Toggle))
{
Instance = this;
}
protected override void WriteComponent(object obj, ES3Writer writer)
{
var instance = (UnityEngine.UI.Toggle)obj;
writer.WriteProperty("toggleTransition", instance.toggleTransition);
writer.WritePropertyByRef("graphic", instance.graphic);
writer.WriteProperty("onValueChanged", instance.onValueChanged);
writer.WriteProperty("isOn", instance.isOn, ES3Type_bool.Instance);
}
protected override void ReadComponent<T>(ES3Reader reader, object obj)
{
var instance = (UnityEngine.UI.Toggle)obj;
foreach(string propertyName in reader.Properties)
{
switch(propertyName)
{
case "toggleTransition":
instance.toggleTransition = reader.Read<UnityEngine.UI.Toggle.ToggleTransition>();
break;
case "graphic":
instance.graphic = reader.Read<UnityEngine.UI.Graphic>();
break;
case "onValueChanged":
instance.onValueChanged = reader.Read<UnityEngine.UI.Toggle.ToggleEvent>();
break;
case "isOn":
instance.isOn = reader.Read<System.Boolean>(ES3Type_bool.Instance);
break;
default:
reader.Skip();
break;
}
}
}
}
public class ES3Type_ToggleArray : ES3ArrayType
{
public static ES3Type Instance;
public ES3Type_ToggleArray() : base(typeof(UnityEngine.UI.Toggle[]), ES3Type_Toggle.Instance)
{
Instance = this;
}
}
}
Is this my problem? If so could you please tell me what to do with the ES3Type script? tnx pupazze