Firebase Sdk Unity Ios Code Example


Example: unity connect to firebase


// Perform the steps at the following link to setup Firebase
// for your Unity project:
https://firebase.google.com/docs/unity/setup

// To connect to the databse in a script, use the following
// two lines:
FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://YOURPROJECTNAME.firebaseio.com/");
DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;

// To get a data snapshot and take action with it:
FirebaseDatabase.DefaultInstance.GetReference("DATABASENAME").GetValueAsync().ContinueWith(task => {
if (task.IsFaulted)
{
// Failure
}
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
// Success
}
});

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable