fix(save): 快照捕获增加管理器单例空值保护

This commit is contained in:
2026-06-17 12:49:55 +08:00
parent c55220d739
commit a633b47d5b
4 changed files with 29 additions and 1 deletions
@@ -1,4 +1,5 @@
using System.Collections;
using UnityEngine;
namespace AibisDream.SaveSystem
{
@@ -13,6 +14,12 @@ namespace AibisDream.SaveSystem
public object Capture()
{
if (ActorManager.Instance == null)
{
Debug.LogWarning("[ActorSnapshotProvider] ActorManager 未初始化,跳过捕获。");
return null;
}
return ActorManager.Instance.CaptureSnapshot();
}
@@ -1,5 +1,6 @@
using System.Collections;
using AibisDream.Kit;
using UnityEngine;
namespace AibisDream.SaveSystem
{
@@ -14,6 +15,12 @@ namespace AibisDream.SaveSystem
public object Capture()
{
if (AudioManager.Instance == null)
{
Debug.LogWarning("[AudioSnapshotProvider] AudioManager 未初始化,跳过捕获。");
return null;
}
return AudioManager.Instance.CaptureSnapshot();
}
@@ -1,4 +1,5 @@
using System.Collections;
using UnityEngine;
namespace AibisDream.SaveSystem
{
@@ -13,6 +14,12 @@ namespace AibisDream.SaveSystem
public object Capture()
{
if (EnvironmentManager.Instance == null)
{
Debug.LogWarning("[EnvironmentSnapshotProvider] EnvironmentManager 未初始化,跳过捕获。");
return null;
}
return EnvironmentManager.Instance.CaptureSnapshot();
}
@@ -1,4 +1,5 @@
using System.Collections;
using System.Collections;
using UnityEngine;
namespace AibisDream.SaveSystem
{
@@ -13,6 +14,12 @@ namespace AibisDream.SaveSystem
public object Capture()
{
if (TimelineCenter.Instance == null)
{
Debug.LogWarning("[TimelineSnapshotProvider] TimelineCenter 未初始化,跳过捕获。");
return null;
}
return TimelineCenter.Instance.CaptureSnapshot();
}