{"record":{"id":"00f1eb7066478850","repo":"EllanJiang/GameFramework","slug":"sound-group-0-is-not-exist","errorCode":null,"errorMessage":"Sound group '{0}' is not exist.","messagePattern":"Sound group '(.+?)' is not exist\\.","errorType":"exception","errorClass":"GameFrameworkException","httpStatus":null,"severity":"error","filePath":"GameFramework/Sound/SoundManager.cs","lineNumber":302,"sourceCode":"            return true;\n        }\n\n        /// <summary>\n        /// 增加声音代理辅助器。\n        /// </summary>\n        /// <param name=\"soundGroupName\">声音组名称。</param>\n        /// <param name=\"soundAgentHelper\">要增加的声音代理辅助器。</param>\n        public void AddSoundAgentHelper(string soundGroupName, ISoundAgentHelper soundAgentHelper)\n        {\n            if (m_SoundHelper == null)\n            {\n                throw new GameFrameworkException(\"You must set sound helper first.\");\n            }\n\n            SoundGroup soundGroup = (SoundGroup)GetSoundGroup(soundGroupName);\n            if (soundGroup == null)\n            {\n                throw new GameFrameworkException(Utility.Text.Format(\"Sound group '{0}' is not exist.\", soundGroupName));\n            }\n\n            soundGroup.AddSoundAgentHelper(m_SoundHelper, soundAgentHelper);\n        }\n\n        /// <summary>\n        /// 获取所有正在加载声音的序列编号。\n        /// </summary>\n        /// <returns>所有正在加载声音的序列编号。</returns>\n        public int[] GetAllLoadingSoundSerialIds()\n        {\n            return m_SoundsBeingLoaded.ToArray();\n        }\n\n        /// <summary>\n        /// 获取所有正在加载声音的序列编号。\n        /// </summary>\n        /// <param name=\"results\">所有正在加载声音的序列编号。</param>","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/EllanJiang/GameFramework/blob/d0c010b05167c58e92350449d04864a91ca13fd2/GameFramework/Sound/SoundManager.cs#L284-L320","documentation":"SoundManager.AddSoundAgentHelper requires that the named sound group already exists before a sound agent helper can be added to it. GetSoundGroup returned null, meaning no group with that name was registered via AddSoundGroup. GameFramework throws a GameFrameworkException instead of failing silently.","triggerScenarios":"Calling AddSoundAgentHelper(soundGroupName, soundAgentHelper) with a group name that was never passed to AddSoundGroup, or after that group was removed, or with a misspelled/differently-cased name.","commonSituations":"Typo in the sound group name during Unity component wiring; calling AddSoundAgentHelper in Awake before the SoundComponent created the group; renaming a group in one place but not the other.","solutions":["Register the sound group first with SoundManager.AddSoundGroup(groupName, capacity) before adding agent helpers.","Verify the group name string matches exactly (case, spelling, no whitespace) the name used in AddSoundGroup.","Check call ordering so AddSoundGroup runs before AddSoundAgentHelper (e.g. both in the same init sequence).","Null-check GetSoundGroup(name) before calling AddSoundAgentHelper and create the group on demand."],"exampleFix":"// before\nSoundManager.AddSoundAgentHelper(\"Music\", soundAgentHelper);\n\n// after\nif (SoundManager.GetSoundGroup(\"Music\") == null)\n{\n    SoundManager.AddSoundGroup(\"Music\", 4);\n}\nSoundManager.AddSoundAgentHelper(\"Music\", soundAgentHelper);","handlingStrategy":"validation","validationCode":"if (soundManager.GetSoundGroup(groupName) == null)\n{\n    soundManager.AddSoundGroup(groupName, 4);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize sound group names in a constants class.","Create all sound groups in one init method that runs before agent wiring.","Never hardcode group names at call sites."],"tags":["sound","gameframework","missing-group","initialization-order"],"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"}