There was a point where I got stuck in the localization system again. My game has an Inbox system. As the player progresses in the game, he receives various messages, and all of them arrive dynamically. I learned to translate dynamic text, but now I have a problem: I save these texts and reload them after the scene changes or the game is restored. What method can I follow in this case? Because there will be different data in each message, it would be a bit ridiculous to keep them one by one. What can I do about this?
using System;
using UnityEngine;
[System.Serializable]
public class MessageData
{
public string title;
public string content;
public string sender;
public DateTime timestamp;
public CalendarManager dateTime;
public bool isRead;
public Sprite parchment;
}
I keep the messages as above, I keep the title and content in string form.
public string ResultText(string clanName, BattleResult result, string date, string playerScore, string enemyScore)
{
return SetResultContent(result) +
"<b>Outcome: </b>" + result.ToString() + "\r\n" +
"<b>Date: </b>" + date + "\r\n" +
"<b>Enemy Clan: </b>" + clanName + "\r\n" +
"<b>Score: </b>" + playerScore + " - " + enemyScore;
}
I posted a sample message here, I put the returned string value into the content variable in MessageData and save it.
I’m using ScriptableObject and JSON for the logging system.