I am trying to get a string reference from reference table.
I must use the INDEX to select the proper string because I’m bound from another script.
I just need the localizedstring to set the value of MAX in the string shown to the player. but I cannot get the string from the string table, I cannot figure out the code to do it.
(Also why I have to set the local variables in the LocalizedString instead of the LocalizedStringEvent since they are shown there?)
public void FillWithMission(MissionBase m, MissionUI owner)
{
//descriptionText.text = m.GetMissionDesc();
// get index of mission and max to reach from the mission entry
int index = Array.IndexOf(Enum.GetValues(typeof(MissionType)), m.GetMissionType());
float value = m.GetMax();
//tries to get the correct entry from a given entry table given the index provided in the function above (string entries in the table follows the same patterns)
StringTable descriptionsTable = missionDescTable.GetTable();
//THIS LINE GIVES ME THE ERROR:
LocalizedString localizedString = descriptionsTable.GetLocalizedString(index);
descriptionEvent.StringReference.SetReference(missionDescTable.TableReference, descriptionsTable.SharedData.Entries[index].Id);
// sets the value found in missions to the smart string
FloatVariable floatToSet = null;
if (!localizedString.TryGetValue("quantity", out var variable))
{
floatToSet = new FloatVariable();
localizedString.Add("quantity", floatToSet);
}
else
{
floatToSet = variable as FloatVariable;
}
floatToSet.Value = value;