Hello.I am one of programmers who want make game with unity.And how i see that i cant do something along.I have some questions.
I want in my game put login system with username and password.I hear that it must be created with GUI box.I have some levels and score need to save (coins ,scores ,level unlock system ) in account.Can i save all data in one account and how?
Hi,
there are various ways you can do this and saving can be quite complicated.
But if you are just looking to save a certain amount of data per users - I think you could create a user class and a list to assign user save to.
for example:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class OfficeDatabase : MonoBehaviour {
public List<office> officeList = new List<office>(); // declaration
}
[System.Serializable]
public class office
{
public int userID;
public string userName;
public int score;
public int coins;
public int [] levelsUnlocked;
}
and then when save you add this user or find and edit/update this user in the list.
If you need something more advanced / or more secure you’ll need to look into serialization.
hope that helps,