Музыка есть

This commit is contained in:
ThomasCharester committed 2025-11-13 23:13:41 +03:00
1 parent 557c4c3dee
commit 346dc97fef
67 files changed
+774 -66

No files matched your search

@@ -9,9 +9,9 @@ namespace Code.Audio
{
// The pool holds plain GameObjects (you can swap this for any component type).
private IObjectPool<AudioSource> _pool;
private AudioSource _sourcePrefab;
private GameObject _sourcePrefab;
public void Initialize(AudioSource sourcePrefab)
public void Initialize(GameObject sourcePrefab)
{
_sourcePrefab = sourcePrefab;
@@ -30,7 +30,7 @@ namespace Code.Audio
// Creates a new pooled GameObject the first time (and whenever the pool needs more).
private AudioSource CreateItem()
{
AudioSource audioSource = Object.Instantiate(_sourcePrefab);
AudioSource audioSource = Object.Instantiate(_sourcePrefab).GetComponent<AudioSource>();
audioSource.name = "PooledAudioSource";
Object.DontDestroyOnLoad(audioSource);
return audioSource;