{"record":{"id":"adc68b86dc589583","repo":"EllanJiang/GameFramework","slug":"sound-group-0-is-not-exist-sound-group-0-is-have-no-sound","errorCode":null,"errorMessage":"Sound group '{0}' is not exist. / Sound group '{0}' is have no sound agent.","messagePattern":"Sound group '(.+?)' is not exist\\. / Sound group '(.+?)' is have no sound agent\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Sound/SoundManager.cs","lineNumber":485,"sourceCode":"            }\n\n            if (errorCode.HasValue)\n            {\n                if (m_PlaySoundFailureEventHandler != null)\n                {\n                    PlaySoundFailureEventArgs playSoundFailureEventArgs = PlaySoundFailureEventArgs.Create(serialId, soundAssetName, soundGroupName, playSoundParams, errorCode.Value, errorMessage, userData);\n                    m_PlaySoundFailureEventHandler(this, playSoundFailureEventArgs);\n                    ReferencePool.Release(playSoundFailureEventArgs);\n\n                    if (playSoundParams.Referenced)\n                    {\n                        ReferencePool.Release(playSoundParams);\n                    }\n\n                    return serialId;\n                }\n\n                throw new GameFrameworkException(errorMessage);\n            }\n\n            m_SoundsBeingLoaded.Add(serialId);\n            m_ResourceManager.LoadAsset(soundAssetName, priority, m_LoadAssetCallbacks, PlaySoundInfo.Create(serialId, soundGroup, playSoundParams, userData));\n            return serialId;\n        }\n\n        /// <summary>\n        /// 停止播放声音。\n        /// </summary>\n        /// <param name=\"serialId\">要停止播放声音的序列编号。</param>\n        /// <returns>是否停止播放声音成功。</returns>\n        public bool StopSound(int serialId)\n        {\n            return StopSound(serialId, Constant.DefaultFadeOutSeconds);\n        }\n\n        /// <summary>","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Sound/SoundManager.cs#L467-L503","documentation":"When PlaySound is given a valid existing sound group, it asks the group for a free sound agent. If the group exists but has no sound agents (or none could accept the sound), the accumulated errorMessage, which reports either a missing sound group or a group with no sound agent, is thrown as a GameFrameworkException.","triggerScenarios":"Calling PlaySound with a soundGroupName that does not exist, or with an existing group created with capacity 0 / no AddSoundAgentHelper calls, so no agent is available to play the sound.","commonSituations":"Sound group created via AddSoundGroup(name, 0) or agents never added; typo in group name passed to PlaySound; group created at runtime after sounds were configured for another name.","solutions":["Verify the group name passed to PlaySound matches one created with AddSoundGroup.","Add at least one sound agent to the group (AddSoundAgentHelper) so it can play sounds.","Create the group with a positive sound agent count (AddSoundGroup(name, count)).","Check GetSoundGroup(name) for null before PlaySound and create the group if absent."],"exampleFix":"// before\nSoundManager.PlaySound(\"BGM\", \"MusicGroup\", 0); // group empty\n\n// after\nvar group = SoundManager.GetSoundGroup(\"MusicGroup\") ?? SoundManager.AddSoundGroup(\"MusicGroup\", 2);\nSoundManager.PlaySound(\"BGM\", \"MusicGroup\", 0);","handlingStrategy":"validation","validationCode":"if (soundManager.GetSoundGroup(groupName) == null)\n{\n    throw new InvalidOperationException($\"Sound group '{groupName}' not configured\");\n}\nsoundManager.PlaySound(assetName, groupName, priority);","typeGuard":null,"tryCatchPattern":"try\n{\n    soundManager.PlaySound(assetName, groupName, priority);\n}\ncatch (GameFrameworkException ex)\n{\n    Debug.LogError($\"Sound setup invalid: {ex.Message}\");\n}","preventionTips":["Verify each group has at least one sound agent via AddSoundAgentHelper.","Avoid AddSoundGroup(name, 0) unless intentionally lazy-loading agents.","Share one source of truth for group names between setup and playback code."],"tags":["sound","gameframework","missing-group","no-agent"],"backgroundTag":"entity-not-found","analyzedSha":"d0c010b05167c58e92350449d04864a91ca13fd2","analyzedAt":"2026-09-15T13:37:15.352Z","contentChangedAt":"2026-09-15T13:37:15.352Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}