【m】停止运行时清空静态对象
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Stary.Evo.AudioCore
|
|||||||
}
|
}
|
||||||
CoroutineHelper.SetRunner();
|
CoroutineHelper.SetRunner();
|
||||||
|
|
||||||
// 初始化 Voice 池(最多 1 个,可动态扩展)
|
// 初始化 Voice 池(初始 1 个,可动态扩展)
|
||||||
poolDict["Voice"] = new Queue<GameObject>();
|
poolDict["Voice"] = new Queue<GameObject>();
|
||||||
CreateAudioSource("Voice");
|
CreateAudioSource("Voice");
|
||||||
|
|
||||||
@@ -37,11 +37,8 @@ namespace Stary.Evo.AudioCore
|
|||||||
|
|
||||||
// 初始化 SFX 池(初始 4 个,可动态扩展)
|
// 初始化 SFX 池(初始 4 个,可动态扩展)
|
||||||
poolDict["SFX"] = new Queue<GameObject>();
|
poolDict["SFX"] = new Queue<GameObject>();
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
CreateAudioSource("SFX");
|
CreateAudioSource("SFX");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建对象
|
/// 创建对象
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Internal;
|
using UnityEngine.Internal;
|
||||||
|
|
||||||
@@ -23,6 +24,17 @@ namespace Stary.Evo.AudioCore
|
|||||||
coroutineRunner.StopCoroutine(myCoroutine);
|
coroutineRunner.StopCoroutine(myCoroutine);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CoroutineRunner : MonoBehaviour { }
|
private class CoroutineRunner : MonoBehaviour
|
||||||
|
{
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
if (coroutineRunner != null)
|
||||||
|
{
|
||||||
|
coroutineRunner.StopAllCoroutines();
|
||||||
|
coroutineRunner = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.audiocore",
|
"name": "com.staryevo.audiocore",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"displayName": "04.AudioCore",
|
"displayName": "04.AudioCore",
|
||||||
"description": "音频播放工具",
|
"description": "音频播放工具",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user