quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

[Question] Unity desktop with Crashlytics + Analytics

Open mmiro1 opened this issue 3 years ago • 12 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.24f1
  • Firebase Unity SDK version: 8.7.0
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Crashlytics
  • Other Firebase Components in use: Analytics
  • Additional SDKs you are using: non
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: desktop
  • Scripting Runtime: Mono and IL2CPP

[REQUIRED] Please describe the question here:

Hi, I am trying to use Analytics and Crashlytics in my projects and I am having some problems with it. I just created a new project to make some testing and I get the same results, I don't see anything from the Firebase console. All the code I am using is the following one:

using Firebase;
using Firebase.Analytics;
using Firebase.Crashlytics;
using Firebase.Extensions;
using UnityEngine;
using UnityEngine.UI;

public class FirebaseManager : MonoBehaviour
{
    GameObject nullGameObject;
    FirebaseApp app;
    public Text text;

    void Start()
    {
        FirebaseApp.LogLevel = LogLevel.Debug;

        FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
        {
            var dependencyStatus = task.Result;
            if (dependencyStatus == DependencyStatus.Available)
            {
                // Create and hold a reference to your FirebaseApp,
                // where app is a Firebase.FirebaseApp property of your application class.
                // Crashlytics will use the DefaultInstance, as well;
                // this ensures that Crashlytics is initialized.
                app = FirebaseApp.DefaultInstance;

                // Set a flag here for indicating that your project is ready to use Firebase.
                //x = true;

                FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
                FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventAppOpen);

                Debug.Log("Ready!");
                text.text = "Ready!";
            }
            else
            {
                Debug.LogError($"Could not resolve all Firebase dependencies: {dependencyStatus}");
                // Firebase Unity SDK is not safe to use here.
            }
        });
    }

    // Methods called by UI buttons

    public void Crash()
    {
        Debug.Log("Crash!");
        text.text = "Crash!";

        Crashlytics.LogException(new System.Exception("test"));
        throw new System.Exception("test exception please ignore");
    }

    public void NullCrash()
    {
        Debug.Log("Crash null!");
        text.text = "Crash null!";

        nullGameObject.transform.position = Vector3.zero;
    }

    public void Log()
    {
        Debug.Log("Log!");
        text.text = "Log!";

        FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLogin);

        FirebaseAnalytics.LogEvent(
            FirebaseAnalytics.EventLogin,
            new Parameter[] {
                new Parameter(FirebaseAnalytics.ParameterMethod, "hello"),
            }
        );
    }

}

As I undestand, with this code and enabling the Analytics and Crashlytics in the firebase project is enough to have it working. After that you only need to add the unity project to firebase as an android app and download the "google-services.json" + install the unity packages of Analytics and Crashlytics.

But in the console I get this output:

image

I supouse that the problem reside in that the app initializer crashlytics is not found, but i don't undestand why.

Am I missing any step or making something wrong? Do I have to make any extra step to have it working in desktop? Also, can I test while running from the Unity editor without makeing a build?

Thank you in advance.

mmiro1 avatar Jan 13 '22 15:01 mmiro1

Hi @mmiro1,

Thanks for reporting this. It appears that neither Crashlytics nor Analytics are supported for desktop according to our documentation.

That being said, are these features that you want implemented in the future?

paulinon avatar Jan 17 '22 16:01 paulinon

Hi @paulinon ,

Thanks for your answer. I didn't realize these products weren't supported for desktop. Regarding your question, it would be great to see them in the future. Is there any date or estimation for when it could be included?

Thank you again and sorry for the inconvenience.

mmiro1 avatar Jan 18 '22 12:01 mmiro1

Hi @mmiro1,

I'm unable to provide a timeline for this. However, you may check this thread for updates. I'll be marking this as a feature request for now.

paulinon avatar Jan 18 '22 13:01 paulinon

Is there any update on this?

waleed347 avatar Feb 23 '23 13:02 waleed347

+1 on having this feature. Currently have to use UGS, and would much rather have everything on firebase

ynj97 avatar Mar 27 '23 21:03 ynj97

Hi Paulinon,

Want to follow up to see if there is any updates on this feature. Would be very helpful.

Thanks

ynj97 avatar Apr 24 '23 18:04 ynj97

Any Plan?

fanhaining avatar Jun 26 '23 10:06 fanhaining

+1

staneta avatar Sep 27 '23 16:09 staneta

I would find this really useful as well.

markusmalmros avatar Sep 30 '23 08:09 markusmalmros

There is a serious lack of great analytics solutions for Unity standalone. UGS is expensive. Firebase Analytics seems like a no brainer, yet it does not support unity standalone builds or the editor.

AldeRoberge avatar Feb 05 '24 00:02 AldeRoberge

Has there been any updates on this? Having analytics on the desktop app would be really useful...

kael558 avatar Apr 19 '24 15:04 kael558

+1

mingxxming avatar May 13 '24 09:05 mingxxming