Keyboard to Database Setup
This is a high point score system built in Unity for Virtual Reality. The project demonstrates a technique for setting up a keyboard in VR. It also features a remote database for storing information. This is useful for storing a list of high scores for a game. Created in Unity using using the Oculus Integration package.
Project Demo:
Screenshots:
Code Sample:
public async void SaveScoreToDataBase(string userName, int score)
{
var document = new BsonDocument { { userName, score } };
await collection.InsertOneAsync(document);
}
public async Task> GetScoresFromDataBase()
{
var allScoresTask = collection.FindAsync(new BsonDocument());
var scoresAwaited = await allScoresTask;
List highscores = new List();
foreach (var score in scoresAwaited.ToList())
{
highscores.Add(Deserialize(score.ToString()));
}
return highscores;
}