EllanJiang/GameFramework · error · GameFrameworkException
Play sound info is invalid.
Error message
Play sound info is invalid.
What it means
LoadAssetSuccessCallback is invoked by the ResourceManager when a sound asset finishes loading; its userData must be a PlaySoundInfo created by PlaySound. If the cast yields null (null or wrong userData), the internal contract between PlaySound and the load callback is broken and this GameFrameworkException is thrown.
Solutions
- Do not reuse SoundManager's private LoadAssetCallbacks for your own LoadAsset calls.
- Ensure PlaySoundInfo objects are only released through ReferencePool once (never double-release).
- If this occurs stock, verify GameFramework and GameFramework.Unity versions match and rebuild.
- Add a null check on PlaySoundInfo.Create arguments if customizing PlaySound internally.
Defensive patterns
Strategy: try-catch
Try / catch
try
{
soundManager.PlaySound(assetName, groupName, priority);
}
catch (GameFrameworkException ex)
{
Debug.LogError($"PlaySound internal failure: {ex.Message}");
} Prevention
- Never pass custom callbacks into SoundManager internals.
- Follow strict ReferencePool Create/Release pairing for PlaySoundInfo.
- Keep GameFramework and Unity wrapper assemblies from the same build.
When it happens
Trigger: The resource layer invoking m_LoadAssetCallbacks with null userData, or PlaySoundInfo.Create returning null (e.g. ReferencePool exhausted/misused); internal misuse of m_LoadAssetCallbacks by custom code.
Common situations: Custom code reusing the manager's LoadAssetCallbacks with different userData; ReferencePool corruption from releasing objects twice; framework version mismatch where PlaySoundInfo layout changed.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Can not find sound ' '.
- Check resources complete callback is invalid.
- Decrypt resource callback is invalid.
- Init resources complete callback is invalid.
- Load sound failure, asset name
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/c6007e66ba1b877a.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Sound/SoundManager.cs:619
public void ResumeSound(int serialId, float fadeInSeconds)
{
foreach (KeyValuePair<string, SoundGroup> soundGroup in m_SoundGroups)
{
if (soundGroup.Value.ResumeSound(serialId, fadeInSeconds))
{
return;
}
}
throw new GameFrameworkException(Utility.Text.Format("Can not find sound '{0}'.", serialId));
}
private void LoadAssetSuccessCallback(string soundAssetName, object soundAsset, float duration, object userData)
{
PlaySoundInfo playSoundInfo = (PlaySoundInfo)userData;
if (playSoundInfo == null)
{
throw new GameFrameworkException("Play sound info is invalid.");
}
if (m_SoundsToReleaseOnLoad.Contains(playSoundInfo.SerialId))
{
m_SoundsToReleaseOnLoad.Remove(playSoundInfo.SerialId);
if (playSoundInfo.PlaySoundParams.Referenced)
{
ReferencePool.Release(playSoundInfo.PlaySoundParams);
}
ReferencePool.Release(playSoundInfo);
m_SoundHelper.ReleaseSoundAsset(soundAsset);
return;
}
m_SoundsBeingLoaded.Remove(playSoundInfo.SerialId);
PlaySoundErrorCode? errorCode = null;View on GitHub (pinned to d0c010b051)