Hi!
I’m making a multiplayer quiz game and I used Scriptableobject to store my quiz data. Now I would like to change it and use Firebase but I hit the wall with it.
I Have a scriptable object to store my questions:
[CreateAssetMenu(fileName = "QuestionsTF", menuName = "QuestionTF")]
public class QuestionTF : ScriptableObject
{
public List<Question> questionstf;
}
And Gamemanager script to handle that.
[SerializeField]
private List<QuestionTF> quizDB;
void Startgame(int index)
{
//int index =0;
unAnswered = new List<Question>();
for (int i = 0; i < quizDB[index].questionstf.Count; i++)
{
unAnswered.Add(quizDB[index].questionstf[i]);
}
SetCurrentquestion();
}
I’m also using category management:
void Awake()
{
for (int i = 0; i < categorybtn.Count; i++)
{
Button localbtn = categorybtn[i];
localbtn.onClick.AddListener(() => Click(localbtn));
}
}
private void Click(Button btn)
{
switch (btn.name)
{
case "Kategoria 1":
Startgame(0);
Debug.Log("start");
categoryPanel.SetActive(false);
break;
case "Kategoria 2":
Startgame(1);
categoryPanel.SetActive(false);
break;
case "Kategoria 3":
Startgame(2);
categoryPanel.SetActive(false);
break;
}
I’ve already established connection to DB - I can add new questions but I have problem with displaying them.
Is there any way how I can directly replace ScriptableObject? I tired to use JsonUtility.From.JsonOverwritte
but I cannot use json and list…I think It’s quite easy but after so much time with this I simply can’t see te right way to do it now (Btw can I use this to also create new questions in SO? I couldn’t find this information anywhere)
Thanks