using System; using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; namespace BulletHellTemplate { public class FavouriteCharacter : MonoBehaviour { private int characterId; /// /// Sets the character ID that will be saved as the favorite. /// /// The ID of the character. public void SetCharacterId(int _characterId) { characterId = _characterId; } /// /// Called when the user clicks to set the favorite character. /// Saves the favorite character locally and in the database. /// public async void OnClickSetFavourite() { try {; PlayerSave.SetFavouriteCharacter(characterId); UICharacterMenu.Singleton.UpdateFavouriteSelected(characterId); await BackendManager.Singleton.SavePlayerCharacterFavouriteAsync(characterId); Debug.Log($"Favourite character updated successfully: {characterId}"); } catch (Exception ex) { Debug.LogError($"Failed to update favourite character: {ex.Message}"); } } } }