The Firebase Realtime Database stores and synchronizes data with our NoSQL cloud database. Data is synced across all clients in realtime, and remains available when your app goes offline.
Before you begin
Before you can use Realtime Database, you need to:
Register your Unity project and configure it to use Firebase.
If your Unity project already uses Firebase, then it's already registered and configured for Firebase.
If you don't have a Unity project, you can download a sample app.
Add the Firebase Unity SDK (specifically,
FirebaseDatabase.unitypackage) to your Unity project.
Note that adding Firebase to your Unity project involves tasks both in the Firebase console and in your open Unity project (for example, you download Firebase config files from the console, then move them into your Unity project).
Create a Database
Navigate to the Realtime Database section of the Firebase console. You'll be prompted to select an existing Firebase project. Follow the database creation workflow.
Select a starting mode for your Firebase Security Rules:
- Test mode
Good for getting started with the mobile and web client libraries, but allows anyone to read and overwrite your data. After testing, make sure to review the Understand Firebase Realtime Database Rules section.
To get started with the web, iOS, or Android SDK, select test mode.
- Locked mode
Denies all reads and writes from mobile and web clients. Your authenticated application servers can still access your database.
Choose a region for the database. Depending on your choice of region, the database namespace will be of the form
<databaseName>.<region>.firebasedatabase.app. For more information, see select locations for your project.
When you enable Realtime Database, it also enables the API in the Cloud API Manager.
Setting up public access
The Realtime Database provides a declarative rules language that allows you to define how your data should be structured, how it should be indexed, and when your data can be read from and written to.
Learn how to structure data for Realtime Database.
Prepare to launch your app: