Firebase Unity SDK

repository·main·Indexed 43 days ago

https://github.com/firebase/firebase-unity-sdk

Provides Firebase services, including Auth, Firestore, Cloud Messaging, Analytics, and App Check, for Unity developers targeting Android, iOS, and desktop (development only). Supports Unity version 2017.4 or higher.

Tokens
22.3K
Snippets
47
Records
150
Agent score
55%

What's inside Firebase Unity SDK

  1. Get Started with Firebase AI Gemini API in Unity

    main

    The Firebase AI Unity SDK provides access to Google's Gemini generative AI models directly within Unity. It is designed for mobile developers and includes security features to protect against unauthorized clients, alongside integrations with other Firebase services.

    You can use this SDK to implement features such as:

    • AI personalization within your application.
    • AI-powered chat experiences.
    • AI-driven optimizations and automation.
  2. Get Started with Cloud Firestore for Firebase

    main

    Cloud Firestore is a flexible, scalable database for mobile, web, and server development. It allows you to store and sync data for client- and server-side development, providing realtime listeners to keep data in sync across client apps and offering offline support for mobile and web to handle network latency or connectivity issues. It integrates seamlessly with other Firebase and Google Cloud Platform products, such as Cloud Functions.

    To configure your Unity project for Firestore, refer to the official Firestore guide.

  3. Available Firebase Unity SDK Packages

    main

    The Firebase Unity SDK provides Unity packages for iOS, tvOS, and Android. The SDK is compatible with .NET 4.x.

    | Feature                             | Unity Package                     |
    |:-----------------------------------:|:---------------------------------:|
    | Firebase AI Logic                   | FirebaseAI.unitypackage           |
    | Firebase Analytics                  | FirebaseAnalytics.unitypackage    |
    | Firebase App Check                   | FirebaseAppCheck.unitypackage     |
    | Firebase Authentication             | FirebaseAuth.unitypackage         |
    | Firebase Crashlytics                | FirebaseCrashlytics.unitypackage  |
    | Cloud Firestore                     | FirebaseFirestore.unitypackage    |
    | Firebase Functions                  | FirebaseFunctions.unitypackage    |
    | Firebase Installations              | FirebaseInstallations.unitypackage|
    | Firebase Messaging                  | FirebaseMessaging.unitypackage    |
    | Firebase Realtime Database          | FirebaseDatabase.unitypackage     |
    | Firebase Remote Config              | FirebaseRemoteConfig.unitypackage |
    | Firebase Storage                    | FirebaseStorage.unitypackage      |
  4. Get started with Google Analytics for Firebase

    main

    Google Analytics for Firebase collects usage and behavior data for your game. The SDK logs two primary types of information:

    • Events: Actions occurring in your game, such as user actions, system events, or errors.
    • User properties: Attributes used to describe user segments (e.g., language preference or geographic location).

    Key Limits & Features:

    • Automatic Logging: Some events and user properties are logged automatically without additional code.
    • Custom Events: You can log up to 500 different Analytics event types.
    • Custom User Properties: You can set up to 25 different Analytics user properties.
    • Volume: There is no limit on the total volume of events your app logs.

    For detailed configuration instructions, refer to the official Analytics guide.

  5. Review Firebase Unity SDK Release Notes

    main

    The Firebase Unity SDK undergoes regular updates. Key historical changes include:

    • v8.0.0 (Breaking Changes): Removed support for the deprecated Instance ID SDK. Remote Config moved to an instanced class model, removing FirebaseRemoteConfigDeprecated and ConfigSettings.IsDeveloperMode.
    • v7.1.0 (Breaking Changes): Remote Config changed to an instanced class. Use the new APIs to manage fetching config data; old static methods are available via FirebaseRemoteConfigDeprecated.
    • v8.3.0 (Breaking Changes): Firestore simplified the API for modifying FirebaseFirestore.Settings, which is a backwards-incompatible change.
    • v8.6.0: Firestore reached General Availability for Android and iOS. Minimum Android SDK version is now 19.
  6. Real-time updates in Firebase Remote Config

    main

    Starting with version 11.0.0, Firebase Remote Config supports real-time configuration updates on Android and iOS. You can use the OnConfigUpdateListener API to receive these updates immediately. Note that existing FetchAsync and ActivateAsync APIs remain functional and are not affected by this change.

    // Use OnConfigUpdateListener to get real-time updates
    // Existing FetchAsync and ActivateAsync APIs are still supported.
  7. Manage Auth credential persistence on Desktop

    main
    On Desktop platforms, Firebase Auth credentials now persist between sessions. When accessing CurrentUser immediately after initializing a FirebaseAuth instance, the SDK will block until the saved user state has finished loading from storage.
  8. Unity Assembly Definitions (.asmdef) in Firebase SDK

    main

    The Firebase Unity SDK uses Unity Assembly Definitions (.asmdef) for C# code included directly in unitypackage or .tgz (UPM) distributions. This is required for including pure C# code within Unity Package Manager packages.

    Currently, .asmdef is enabled for:

    • Firebase AI (Firebase.FirebaseAI)
    • Functions (Firebase.Functions)
    • App Core (Firebase.App.Internal)