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
	}
});