In my code I have this long dictionary:
static Dictionary<string, Dictionary<string, string>> Translations = new Dictionary<string, Dictionary<string, string>>() {
["English"] = new Dictionary<string, string>() {
["date0"] = "Tuesday, 22nd January 2019",
["time0"] = "8:38 PM",
["date1"] = "Saturday, 14th September 2019",
["time1"] = "5:26 PM",
["date2"] = "Saturday, 28th March 2020",
["time2"] = "7:52 AM",
["date3"] = "Saturday, 28th March 2020",
["time3"] = "1:03 PM",
...
},
["Italian"] = new Dictionary<string, string>() {
["date0"] = "Martedì, 22 gennaio 2019",
["time0"] = "20:38",
["date1"] = "Sabato, 14 settembre 2019",
["time1"] = "17:26",
["date2"] = "Sabato, 28 marzo 2020",
["time2"] = "7:52",
["date3"] = "Sabato, 28 marzo 2020",
["time3"] = "13:03",
...
}
}
As a workaround to a Unity bug (Unity Issue Tracker - [IL2CPP] Build hangs while building a project with a large array of strings), I have to load data from an external file or encode it as a stream of bytes.
You can then read the data into an array (or a dictionary, in my case) yourself and avoid the time/memory expended by the C++ compiler.
How do I accomplish this task?