FMOD instance errors fix
This commit is contained in:
Binary file not shown.
@@ -291,6 +291,11 @@ public class AudioManager : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Pause()
|
||||||
|
{
|
||||||
|
musicEventInstance.setPaused(true);
|
||||||
|
}
|
||||||
|
|
||||||
//=====//
|
//=====//
|
||||||
//=====//
|
//=====//
|
||||||
|
|
||||||
@@ -323,6 +328,8 @@ public class AudioManager : MonoBehaviour
|
|||||||
// Set the callback for programmer sounds
|
// Set the callback for programmer sounds
|
||||||
instance.setCallback(dialogueCallback);
|
instance.setCallback(dialogueCallback);
|
||||||
|
|
||||||
|
bool managedByOcclusion = false;
|
||||||
|
|
||||||
// Add occlusion if available on the emitter
|
// Add occlusion if available on the emitter
|
||||||
if (emitter != null)
|
if (emitter != null)
|
||||||
{
|
{
|
||||||
@@ -330,12 +337,17 @@ public class AudioManager : MonoBehaviour
|
|||||||
if (occlusion != null)
|
if (occlusion != null)
|
||||||
{
|
{
|
||||||
occlusion.InitialiseWithInstance(instance);
|
occlusion.InitialiseWithInstance(instance);
|
||||||
|
managedByOcclusion = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.start();
|
instance.start();
|
||||||
|
|
||||||
|
if (!managedByOcclusion)
|
||||||
|
{
|
||||||
instance.release();
|
instance.release();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[AOT.MonoPInvokeCallback(typeof(EVENT_CALLBACK))]
|
[AOT.MonoPInvokeCallback(typeof(EVENT_CALLBACK))]
|
||||||
@@ -414,11 +426,6 @@ public class AudioManager : MonoBehaviour
|
|||||||
instance.setPaused(false);
|
instance.setPaused(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Pause()
|
|
||||||
{
|
|
||||||
musicEventInstance.setPaused(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Pause(EventInstance instance)
|
public static void Pause(EventInstance instance)
|
||||||
{
|
{
|
||||||
instance.setPaused(true);
|
instance.setPaused(true);
|
||||||
@@ -430,10 +437,12 @@ public class AudioManager : MonoBehaviour
|
|||||||
{
|
{
|
||||||
foreach (EventInstance eventInstance in eventInstances)
|
foreach (EventInstance eventInstance in eventInstances)
|
||||||
{
|
{
|
||||||
|
if (eventInstance.isValid()) {
|
||||||
eventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
|
eventInstance.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
|
||||||
eventInstance.release();
|
eventInstance.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class FirstPersonOcclusion : MonoBehaviour
|
|||||||
AudioOccluded.start();
|
AudioOccluded.start();
|
||||||
|
|
||||||
// 4. Releasing Instance (This allows the event to self-manage its lifetime, which is fine)
|
// 4. Releasing Instance (This allows the event to self-manage its lifetime, which is fine)
|
||||||
AudioOccluded.release();
|
//AudioOccluded.release();
|
||||||
|
|
||||||
managedInstances.Add(AudioOccluded); // ADDED
|
managedInstances.Add(AudioOccluded); // ADDED
|
||||||
|
|
||||||
@@ -205,4 +205,17 @@ public class FirstPersonOcclusion : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
// Stop & release all instances when this object is destroyed
|
||||||
|
foreach (var inst in managedInstances)
|
||||||
|
{
|
||||||
|
if (inst.isValid())
|
||||||
|
{
|
||||||
|
inst.stop(FMOD.Studio.STOP_MODE.IMMEDIATE);
|
||||||
|
inst.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
managedInstances.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
"name": "timur",
|
"name": "timur",
|
||||||
"score": 486.0
|
"score": 486.0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "taavi",
|
||||||
|
"score": 480.0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ppppVBBPPP",
|
"name": "ppppVBBPPP",
|
||||||
"score": 478.0
|
"score": 478.0
|
||||||
@@ -55,10 +59,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yty",
|
"name": "yty",
|
||||||
"score": 446.0
|
"score": 446.0
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "lp",
|
|
||||||
"score": 444.0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user