ES3Type.type is null

Discussion and help for Easy Save 3
Post Reply
tuanha
Posts: 12
Joined: Wed Jun 08, 2022 1:41 am

ES3Type.type is null

Post by tuanha »

I got this error, please help

ES3Type.type is null when trying to create an ES3Type for System.Collections.Generic.Dictionary`2[System.Int16,Music], possibly because the element type is not supported.

public static Dictionary<short, Music> musics = new Dictionary<short, Music>();

Dictionary "musics " already has data called by method:

public static void SaveCACHE_MP3(Dictionary<short, Music> musics , string ver)
{
try
{
//settings = new ES3Settings(ES3.Location.Cache);
ES3.Save<int>(ver + "mp3", Main.musics.Count);
ES3.Save<Dictionary<short, Music>>(ver, musics);
Debug.Log("SAVE LOG MP3 OK");
}
catch (Exception ex)
{
Debug.Log("SAVE LOG MP3 error: " + ex.Message);
}
}


Class:
public class Music
{

public short id;
public string name;
public string author;
public short bpm;
public short round;
public float[] start;//Bi?n này
public short end;
public short len;

public Music(short id, string name, string author, short bpm, short len)
{
this.id = id;
this.name = name;
this.author = author;
this.bpm = bpm;
this.len = len;
}

public Music(short id, string name, string author, short bpm, short round, float[] start, short end, short len)
{
this.id = id;
this.name = name;
this.author = author;
this.bpm = bpm;
this.round = round;
this.start = start;
this.end = end;
this.len = len;
}
}
I can't find the reason I need help, thanks!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: ES3Type.type is null

Post by Joel »

Hi there,

Your Music class is not supported because it doesn't have a parameterless constructor. Adding a parameterless constructor to it will resolve the issue.

For more information on what is supported please see the Supported Types guide:
https://docs.moodkie.com/easy-save-3/es ... ted-types/

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