Untitled

mail@pastecode.io avatar
unknown
csharp
a year ago
987 B
1
Indexable
Never
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
    }
}