So I’m encountering a strange error when playing one-shot audio clips. In reality it’s actually two errors, but they occur simultaneously:
“No FMOD::ChannelGroup to connect to in AudioClipPlayable::ApplyProperties”
“Should not see NULL ChannelGroup in AudioPlayable::ApplyConnectionVolumesVisitor”
I went through the source code provided in the video and confirmed I’ve copied everything beat for beat, so I don’t think it’s an issue with the code.
What’s strange is that the audio clip plays as expected, and the game doesn’t crash or pause when I get the error. It’s also not pointing to specific object, script, component, etc. that’s throwing the error. So that leads me to believe it’s an issue with the project itself, but I’m not sure.
So if everything is working normally, it might be that our internal management encounters an error and manages it, but the log still appears. Could you trim the project (or a clone of it) around this error and submit a bug report so we can have a look at it?
Cheers!
Thanks for your comment. I’ve submitted a bug report with a clone of the project trimmed down to just this issue. I’ve tested it and confirmed everything is still working and the bug still appears as expected.
With some help from AI, and not much help from documentation, I managed to fix the problem from that tutorial:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Playables;
public class FootstepPlayableBehaviour : PlayableBehaviour
{
public AudioClip[] footstepSounds;
public ExposedReference<AudioSource> audioSource;
AudioSource resolvedAudioSource;
PlayableGraph playableGraph;
AudioClipPlayable currentClipPlayable;
public override void OnGraphStart(Playable playable)
{
// Resolve the audio source and initialize the playable graph.
resolvedAudioSource = audioSource.Resolve(playable.GetGraph().GetResolver());
playableGraph = playable.GetGraph();
if (resolvedAudioSource == null)
{
Debug.LogError("Resolved AudioSource is null!");
return;
}
// Create the AudioPlayableOutput and link it to the AudioSource.
var audioOutput = AudioPlayableOutput.Create(playableGraph, "FootstepAudio", resolvedAudioSource);
// Ensure the graph starts playing
playableGraph.Play();
Debug.Log("Graph Started Successfully.");
}
public void PlayFootstepSound()
{
if (footstepSounds == null || footstepSounds.Length == 0 || resolvedAudioSource == null)
{
Debug.LogWarning("No footstep sounds available or AudioSource is null.");
return;
}
AudioClip selectedClip = footstepSounds[Random.Range(0, footstepSounds.Length)];
var newClipPlayable = AudioClipPlayable.Create(playableGraph, selectedClip, false);
// Log the selected clip
Debug.Log("Selected Footstep Clip: " + selectedClip.name);
if (currentClipPlayable.IsValid())
{
// Destroy the old clip
playableGraph.DestroyPlayable(currentClipPlayable);
}
// Ensure the new clip is valid before proceeding.
if (!newClipPlayable.IsValid())
{
Debug.LogError("New Clip Playable is not valid!");
return;
}
// Connect the new clip directly to the audio output.
var audioOutput = AudioPlayableOutput.Create(playableGraph, "FootstepAudio", resolvedAudioSource);
audioOutput.SetSourcePlayable(newClipPlayable);
// Update the current clip playable.
currentClipPlayable = newClipPlayable;
Debug.Log("Footstep sound played: " + selectedClip.name);
}
}