Hi, I’ve been trying to find a solution for this but am stuck, so any advice is really appreciated.
Right now, I have a list that is used to display strings in the list at random to the user, using Random.Range. However, those answers are not recorded or saved, so the user has no way of knowing how many of these answers they have unlocked.
This is what I have right now:
List<string> allLocations = new List<string>();
allLocations.Insert(0, "Answer 1");
allLocations.Insert(1, "Answer 2");
allLocations.Insert(2, "Answer 3");
// Display random answer from list
string displayAnswer = allLocations[Random.Range(0, allLocations.Count)];
I would like to implement a way to record each displayed string if hasn’t been shown to the user before, and sort the string in a list (or more suitable option) according to different categories.
E.g if either of the strings"Answer 1" or “Answer 2” are displayed and it has not been shown to the user before, it will be recorded and count as one answer unlocked in Category A of the achievements. If the string “Answer 3” is displayed to the user for the first time, it will count as one answer unlocked in Category B.
Ideally I would be able to sort these unlocked answer strings, so that the user can see how many of the answers they have unlocked in each category. There are 101 strings of these unlocked answers which are broken down into 10 categories for the achievements.
How do I implement this and make the record of the strings previously displayed to the user accessible to a script displaying achievements? I read that JSON data serialization is better for this than PlayerPrefs, but I am unsure how to implement this.
Thank you! I apologize in advance if this is a stupid question; I’m really new to Unity and C#.