Last improvements on the save front

This commit is contained in:
Michal Pikulski
2025-11-05 17:34:26 +01:00
committed by Michal Pikulski
parent b3e0f90e09
commit 64253c1048
14 changed files with 610 additions and 176 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using UnityEngine;
@@ -382,8 +382,9 @@ namespace Core.Lifecycle
string serializedData = component.InvokeSceneSaveRequested();
if (!string.IsNullOrEmpty(serializedData))
{
saveData[component.SaveId] = serializedData;
LogDebug($"Collected scene save data from: {component.SaveId}");
string saveId = component.SaveId;
saveData[saveId] = serializedData;
LogDebug($"Collected scene save data from: {saveId} (Type: {component.GetType().Name})");
}
}
catch (Exception ex)

View File

@@ -66,7 +66,7 @@ namespace Core.Lifecycle
/// <summary>
/// Unique identifier for this component in the save system.
/// Default: "SceneName/GameObjectName"
/// Default: "SceneName/GameObjectName/ComponentType"
/// Override ONLY for special cases (e.g., singletons like "PlayerController", or custom IDs).
/// </summary>
public virtual string SaveId
@@ -74,7 +74,8 @@ namespace Core.Lifecycle
get
{
string sceneName = gameObject.scene.IsValid() ? gameObject.scene.name : "UnknownScene";
return $"{sceneName}/{gameObject.name}";
string componentType = GetType().Name;
return $"{sceneName}/{gameObject.name}/{componentType}";
}
}