Hi,
in my game I save all the data in a mysql database, now that I have integrated the dialogue system plugin I would also need to save the variables and the status of the quests.
How could I do?
Thanks
Nicolò
Save data on mysql database
Re: Save data on mysql database
Hi,
Use PersistentDataManager.GetSaveData() and ApplySaveData(). See Database-Only Save for the 3 lines of code you'll need.
Use PersistentDataManager.GetSaveData() and ApplySaveData(). See Database-Only Save for the 3 lines of code you'll need.
Re: Save data on mysql database
Thanks it work really well!
There is a method to execute this function on every change made in the database (variable change or quest status)?
public void SaveDB()
{
string username = UserData.Instance.Username;
string authToken = UserData.Instance.Token;
StartCoroutine(SaveDatabase(username, authToken));
}
Nicolò
There is a method to execute this function on every change made in the database (variable change or quest status)?
public void SaveDB()
{
string username = UserData.Instance.Username;
string authToken = UserData.Instance.Token;
StartCoroutine(SaveDatabase(username, authToken));
}
Nicolò
Re: Save data on mysql database
Yes for quest state. Use OnQuestStateChange.
No for variables. A common way to do this is to use OnConversationEnd and save variables when a conversation has ended.
No for variables. A common way to do this is to use OnConversationEnd and save variables when a conversation has ended.