Untitled

 avatar
unknown
csharp
2 years ago
987 B
4
Indexable
using UnityEngine;
using Firebase;
using Firebase.Auth;

public class AccountManager : MonoBehaviour
{
    private FirebaseAuth auth;

    private void Start()
    {
        // Get the Firebase Auth reference
        auth = FirebaseAuth.DefaultInstance;
    }

    public void DeleteAccount()
    {
        // Delete the user account
        FirebaseUser user = auth.CurrentUser;
        user.DeleteAsync().ContinueWith(task => {
            if (task.IsCompleted)
            {
                Debug.Log("Account deleted.");
                MainMenu(); // Navigate to the main menu when the account is deleted
            }
            else if (task.IsFaulted)
            {
                Debug.LogError("Account deletion error: " + task.Exception);
            }
        });
    }

    private void MainMenu()
    {
        // Navigate to the main menu
        Debug.Log("Navigating to the main menu...");
        // Add the necessary code here to transition to the main menu
    }
}
Editor is loading...