Update the cards to pull in from addressables to wokr in build, remove erronous code preventing building

This commit is contained in:
Michal Adam Pikulski
2025-10-21 10:05:49 +02:00
parent d1792014db
commit af77e07f99
20 changed files with 531 additions and 84 deletions

View File

@@ -4,8 +4,10 @@ using System.Linq;
using AppleHills.Data.CardSystem;
using AppleHills.UI.CardSystem;
using UnityEditor;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
using UnityEngine.UI;
using AppleHills.Editor.Utilities;
namespace AppleHills.Editor.CardSystem
{
@@ -1078,7 +1080,20 @@ namespace AppleHills.Editor.CardSystem
// Mark as dirty and save
EditorUtility.SetDirty(_selectedCard);
AssetDatabase.SaveAssets();
// Add to Addressables group "BlokkemonCards" and apply "BlokkemonCard" label
string assetPath = AssetDatabase.GetAssetPath(_selectedCard);
if (!string.IsNullOrEmpty(assetPath))
{
if (AddressablesUtility.EnsureAssetInGroupWithLabel(assetPath, "BlokkemonCards", "BlokkemonCard"))
{
AddressablesUtility.SaveAddressableAssets();
}
else
{
Debug.LogError("Failed to add card to Addressables. Please ensure Addressables are set up in this project.");
}
}
// Clear dirty flag
_isDirty = false;
}