Why doesn’t LogEvent FireBase work in Unity 2022.3.14f1?

  Kiến thức lập trình

I’ve been trying to add analytics to my game for 2 days now, on the second day I was finally able to build the project, but another problem arose, my events are not displayed in the FireBase RealTime Console. I don’t know what to do, code below

`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Firebase.Extensions;
using Firebase.Analytics;

public class Analytics : MonoBehaviour
{

    private void Awake()
    {
        Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
        {
            var dependencyStatus = task.Result;
            if (dependencyStatus == Firebase.DependencyStatus.Available)
            {
            // Create and hold a reference to your FirebaseApp,
            // where app is a Firebase.FirebaseApp property of your application class.

            Firebase.FirebaseApp app = Firebase.FirebaseApp.DefaultInstance;
            FirebaseAnalytics.LogEvent("first_open");
            FirebaseAnalytics.LogEvent("test_event");

            FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventAppOpen);

            // Set a flag here to indicate whether Firebase is ready to use by your app.
            Debug.Log("FBReady");
        }
        else
        {
            UnityEngine.Debug.LogError(System.String.Format(
              "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
            // Firebase Unity SDK is not safe to use here.
        }
    });
}
private void Start()
{
    FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventAppOpen);
    FirebaseAnalytics.LogEvent("first_open");
    FirebaseAnalytics.LogEvent("GameStart");
    FirebaseAnalytics.LogEvent("test_event");
    FirebaseAnalytics.LogEvent(FirebaseAnalytics.EventLevelStart);

    Events();
}

public void EventTriggerTest()
{
    FirebaseAnalytics.LogEvent("TestEvent");
    
    Debug.Log("EventWasLoged");
}

public void EventTriggerTest(int number)
{
    FirebaseAnalytics.LogEvent("TestEventParam", new Parameter[]
    {
        new Parameter("ButtonNumber",number)
    });

    Debug.Log("EventParamWasLoged");
}

public void Events()
{
    Firebase.Analytics.FirebaseAnalytics.LogEvent(
Firebase.Analytics.FirebaseAnalytics.EventSelectContent,
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterItemId, "0"),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.ParameterItemName, "name"),
new Firebase.Analytics.Parameter(
Firebase.Analytics.FirebaseAnalytics.UserPropertySignUpMethod, "Google"),

new Firebase.Analytics.Parameter(
"user_id", "0"));
}

}`

At the first launch after reinstallation, I only see the first_open event, but I don’t see my events that I bound to the buttons and to the start method. I read somewhere that you need to wait 24 hours for it to display in FireBase, I found a debugging method, but I don’t understand the code to insert these lines that enable Debug, so I’m stuck, I can only wait 24 hours from pressing the buttons and hope that events will appear

adb shell setprop log.tag.FA VERBOSE

adb shell setprop log.tag.FA-SVC VERBOSE

adb logcat -v time -s FA FA-SVC

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT