Page 1 of 1

Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Sat Jul 17, 2021 3:20 pm
by caka99
The exception:
[Exception] FormatException: Input string was not in a correct format.
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.

ES3JSONReader.Read_int() at /Plugins/Easy Save 3/Scripts/Readers/ES3JSONReader.cs:549
-->549: internal override int Read_int(){ return int.Parse(GetValueString()); }

ES3Type_enum.Read[T]() at /Plugins/Easy Save 3/Scripts/Types/Primitive Types/ES3Type_enum.cs:42
-->42: if(underlyingType == typeof(int)) return Enum.ToObject (type, reader.Read_int());
I have to change enum to int:
Write:

Code: Select all

		protected override void WriteComponent(object obj, ES3Writer writer)
		{
			var instance = (NaAGames.Humanoid)obj;

			//writer.WriteProperty("humanoidState", instance.humanoidState, ES3Internal.ES3TypeMgr.GetES3Type(typeof(NaAGames.HumanoidState)));
			writer.WriteProperty("humanoidState", instance.humanoidState, ES3Type_int.Instance);
		}
Read:

Code: Select all

		protected override void ReadComponent<T>(ES3Reader reader, object obj)
		{
			var instance = (NaAGames.Humanoid)obj;
			foreach(string propertyName in reader.Properties)
			{
				switch(propertyName)
				{
					
					case "humanoidState":
						//instance.humanoidState = reader.Read<NaAGames.HumanoidState>();
						instance.humanoidState = (NaAGames.HumanoidState)reader.Read<System.Int32>(ES3Type_int.Instance);
						break;
				}
			}
		}
	}

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Sat Jul 17, 2021 4:14 pm
by Joel
Hi there,

Thanks for sending that over. I've managed to replicate this at my end and will ensure this is resolved in the next update.

If you could also remove the support request from the reviews section of the Asset Store that would also be greatly appreciated.

All the best,
Joel

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Sun Jul 18, 2021 2:30 am
by caka99
Thanks!
Ok!

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Mon Jul 26, 2021 5:59 am
by tarlan83
And when do you intend to release the new version, since I have the same problem?! :(

Thanks in advance!

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Mon Jul 26, 2021 12:46 pm
by Joel
Hi there,

This version is now live on the Asset Store, so updating and deleting your previous save data should resolve the issue.

If it doesn't, if you private message me your invoice number I'll send over the update directly as it may be that the Asset Store is failing to update.

All the best,
Joel

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Fri Sep 03, 2021 2:16 pm
by hassan121
Hi Joel, I am updating the package but it is still does'nt seem to fix the issue. I am still having issue with enums.

FormatException: Input string was not in a correct format.
System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Int32.Parse (System.String s) (at <9577ac7a62ef43179789031239ba8798>:0)
ES3Internal.ES3JSONReader.Read_int () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3JSONReader.cs:549)
ES3Types.ES3Type_enum.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Primitive Types/ES3Type_enum.cs:42)

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Fri Sep 03, 2021 4:18 pm
by Joel
Hi there,

Have you deleted your previous save data?

All the best,
Joel

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Mon Sep 06, 2021 9:00 am
by hassan121
Yes, I have deleted everything and tried multiple times. It never works with enums.

Re: Exception thrown when reading ES3UserType_xxx with an enum variable

Posted: Mon Sep 06, 2021 11:20 am
by hassan121
hassan121 wrote: Mon Sep 06, 2021 9:00 am Yes, I have deleted everything and tried multiple times. It never works with enums.
Hi, I found out what the issue was. I mistakenly left ES3 Auto Save component attached to one of the GameObjects which didn't have some scripts components referenced in it. I removed it and the issue was fixed. I was really tough to find out though and I got lucky in finding it.