Page 1 of 1

Problem Saving multidimensional List auf Class

Posted: Fri Jun 15, 2018 6:16 pm
by Chaosgod_Espér
Hi there..

I got some Problems saving this Class:

Code: Select all

	public class TilemapData{
		public int Tile_Typeindex;
		public int Tile_TypeSubindex;
		public float Tile_Walkfactor;
		public bool Tile_Hidden;
		public int Tile_SelfLayer;
		public float Tile_DealDamage;
		public float Tile_DealFrost;
		
		public TilemapData(){
			Tile_Typeindex = 0;
			Tile_TypeSubindex = 0;
			Tile_Walkfactor = 1.0f;
			Tile_Hidden = false;
			Tile_SelfLayer = 0;
			Tile_DealDamage = 0.0f;
			Tile_DealFrost = 0.0f;
		}
	}
as a 3D List:

Code: Select all

	[SerializeField]
	private List<List<List<TilemapData>>> TM_Data;
With this code for Save and Load:

Code: Select all

//Path
private string Filepath = "";

//[...]
Filepath = Application.dataPath + "/";

//Saving
ES2.Save<List<List<List<TilemapData>>>>(TM_Data, Filepath + "MapData/Mapname.mdat");

//[...]

//Loading
if(ES2.Exists(Filepath + "MapData/Mapname.mdat")){
				TM_Data = ES2.Load<List<List<List<TilemapData>>>>(Filepath + "MapData/Mapname.mdat");
			}
I always geht the Error:
ES2InvalidDataException: Easy Save 2 Error: The file provided does not contain data that is readable by Easy Save. Please make sure that file was created by Easy Save.
ES2Reader.Next () (at Assets/Plugins/Easy Save 2/Scripts/Readers/ES2Reader.cs:527)
ES2Reader.ScanToTag (string) (at Assets/Plugins/Easy Save 2/Scripts/Readers/ES2Reader.cs:851)
ES2Reader.ProcessHeader (ES2Keys/Key,ES2Type,ES2Type,string) (at Assets/Plugins/Easy Save 2/Scripts/Readers/ES2Reader.cs:402)
ES2Reader.Read<System.Collections.Generic.List`1<System.Collections.Generic.List`1<System.Collections.Generic.List`1<Scr_MapSetup/TilemapData>>>> (string) <0x00102>
ES2.Load<System.Collections.Generic.List`1<System.Collections.Generic.List`1<System.Collections.Generic.List`1<Scr_MapSetup/TilemapData>>>> (string) <0x00191>
Scr_MapSetup.SpawnAndRefreshMap () (at Assets/05_Scripts/Scripts_Mapping/Scr_MapSetup.cs:199)
Scr_MapSetup.GenerateMap () (at Assets/05_Scripts/Scripts_Mapping/Scr_MapSetup.cs:82)
(wrapper dynamic-method) object.Scr_MapSetup.call_GenerateMap (object) <IL 0x00006, 0x00082>
Sirenix.OdinInspector.Editor.Drawers.MethodPropertyDrawer`1<Scr_MapSetup>.DrawPropertyImplementation (Sirenix.OdinInspector.Editor.InspectorProperty,UnityEngine.GUIContent) <0x018ee>
UnityEngine.Debug:LogException(Exception)
Sirenix.OdinInspector.Editor.Drawers.MethodPropertyDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/AssetListAttributeDrawer.cs:394)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.MarkObjectsDirtyOnButtonClickDrawer:DrawPropertyLayout(InspectorProperty, ButtonAttribute, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/OdinSelectors/EnumSelector.cs:137)
Sirenix.OdinInspector.Editor.OdinAttributeDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:2167)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.GUIColorAttributeDrawer:DrawPropertyLayout(InspectorProperty, GUIColorAttribute, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/DrawerLocator.cs:97)
Sirenix.OdinInspector.Editor.OdinAttributeDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:2167)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.PropertyTooltipAttributeDrawer:DrawPropertyLayout(InspectorProperty, PropertyTooltipAttribute, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/TwoDimensionalArrayDrawer.cs:335)
Sirenix.OdinInspector.Editor.OdinAttributeDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:2167)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:CallNextDrawer(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.HideIfAttributeDrawer:DrawPropertyLayout(InspectorProperty, HideIfAttribute, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Misc/DrawerLocator.cs:239)
Sirenix.OdinInspector.Editor.OdinAttributeDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/PropertyTree.cs:2167)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty)
Sirenix.OdinInspector.Editor.Drawers.ButtonGroupAttributeDrawer:DrawPropertyGroupLayout(InspectorProperty, ButtonGroupAttribute, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Value Drawers/QuaternionDrawer.cs:61)
Sirenix.OdinInspector.Editor.OdinGroupDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.Drawers.HorizontalGroupAttributeDrawer:DrawPropertyGroupLayout(InspectorProperty, HorizontalGroupAttribute, GUIContent) (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Infos/InspectorPropertyInfo.cs:632)
Sirenix.OdinInspector.Editor.OdinGroupDrawer`1:DrawPropertyImplementation(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.OdinDrawer:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty, GUIContent)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawProperty(InspectorProperty)
Sirenix.OdinInspector.Editor.InspectorUtilities:DrawPropertiesInTree(PropertyTree)
Sirenix.OdinInspector.Editor.PropertyTree:Draw(Boolean)
Sirenix.OdinInspector.Editor.OdinEditor:DrawTree() (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/PropertyValueCollection.cs:541)
Sirenix.OdinInspector.Editor.OdinEditor:DrawOdinInspector() (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/PropertyValueCollection.cs:533)
Sirenix.OdinInspector.Editor.OdinEditor:OnInspectorGUI() (at F:/Sirenix/Sirenix Solution/Sirenix.OdinInspector.Editor/Core/Children/PropertyValueCollection.cs:516)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

So.. is a 3D List supported? I tried LoadList for sure.. but get the same Error.

Re: Problem Saving multidimensional List auf Class

Posted: Fri Jun 15, 2018 7:39 pm
by Joel
Hi there,

As mentioned in the Supported Types page, collections containing collections must be supported using wrapper classes in Easy Save 2, as described here.

Note that they are supported by standard in Easy Save 3.

All the best,
Joel