fix: 删除Start()中_bgAudioSource初始化+修复PlayExperimentBg调用
This commit is contained in:
@@ -49,13 +49,6 @@ public class PageController : MonoBehaviour
|
||||
{
|
||||
Debug.Log("=== PageController 初始化开始 ===");
|
||||
|
||||
// 背景音乐 AudioSource
|
||||
var mgr = GameObject.Find("[Managers]");
|
||||
if (mgr != null) { _bgAudioSource = mgr.AddComponent<AudioSource>(); }
|
||||
else { _bgAudioSource = gameObject.AddComponent<AudioSource>(); }
|
||||
_bgAudioSource.loop = true;
|
||||
_bgAudioSource.playOnAwake = false;
|
||||
_bgAudioSource.spatialBlend = 0f;
|
||||
// 关掉多余AudioListener(只留Main Camera的)
|
||||
var cam2 = GameObject.Find("camera2"); if (cam2 != null) { var al = cam2.GetComponent<AudioListener>(); if (al != null) al.enabled = false; }
|
||||
var cam3 = GameObject.Find("camera3"); if (cam3 != null) { var al = cam3.GetComponent<AudioListener>(); if (al != null) al.enabled = false; }
|
||||
@@ -274,7 +267,7 @@ public class PageController : MonoBehaviour
|
||||
{
|
||||
Debug.Log("PageController: [ActivateExperimentObjects] 显示实验物件");
|
||||
|
||||
PlayExperimentBg();
|
||||
BGMController.PlayExperimentBg();
|
||||
|
||||
var allObjects = FindObjectsOfType<GameObject>(true);
|
||||
foreach (var go in allObjects)
|
||||
|
||||
Reference in New Issue
Block a user