{"record":{"id":"eeadb5db57169ae4","repo":"Unity-Technologies/UnityCsReference","slug":"failed-to-add-player-icon","errorCode":null,"errorMessage":"Failed to add player icon","messagePattern":"Failed to add player icon","errorType":"exception","errorClass":"BuildFailedException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs","lineNumber":349,"sourceCode":"            string stagingAreaDataManaged = \"Temp/StagingArea/Data/Managed\";\n            string playerPackage = BuildPipeline.GetPlaybackEngineDirectory(target, options);\n\n            // Disallow providing an empty string as the installPath\n            bool willInstallInBuildFolder = (options & BuildOptions.InstallInBuildFolder) != 0 && SupportsInstallInBuildFolder(target);\n            if (installPath == String.Empty && !willInstallInBuildFolder)\n                throw new Exception(installPath + \" must not be an empty string\");\n\n            IBuildPostprocessor postprocessor = ModuleManager.GetBuildPostProcessor(target);\n            if (postprocessor == null)\n                // If postprocessor is not provided, build target is not supported\n                throw new UnityException($\"Build target '{target}' not supported\");\n\n            try\n            {\n                AddIconsArgs iconArgs;\n                iconArgs.stagingArea = stagingArea;\n                if (!postprocessor.AddIconsToBuild(iconArgs))\n                    throw new BuildFailedException(\"Failed to add player icon\");\n\n                BuildPostProcessArgs args;\n                args.target = target;\n                args.subtarget = subtarget;\n                args.stagingAreaData = stagingAreaData;\n                args.stagingArea = stagingArea;\n                args.stagingAreaDataManaged = stagingAreaDataManaged;\n                args.playerPackage = playerPackage;\n                args.installPath = installPath;\n                args.companyName = companyName;\n                args.productName = productName;\n                args.productGUID = PlayerSettings.productGUID;\n                args.options = options;\n                args.usedClassRegistry = usedClassRegistry;\n                args.report = report;\n                args.defineConstraints = defineConstraints;\n\n                BuildProperties props;","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs#L331-L367","documentation":"Thrown as BuildFailedException when postprocessor.AddIconsToBuild(args) returns false, meaning the platform post-processor could not supply the required player icon(s) into the staging area for the build.","triggerScenarios":"Postprocess calls AddIconsToBuild and the target's IBuildPostprocessor reports failure (missing icon texture, wrong icon size/format, icon settings invalid for the platform).","commonSituations":"Player Settings > Default Icon not assigned or texture not readable/imported correctly; platform-specific icon slot (e.g. Android adaptive icon, iOS icon set) missing or wrong resolution; icon asset deleted after being referenced.","solutions":["Assign a valid Default Icon in Player Settings and ensure platform icon slots are filled with correctly sized, readable textures.","Verify icon textures are imported as Sprite/Editor or GUI with Read/Write enabled if the platform requires it.","Check the post-processor logs for the specific icon slot that failed and fix that asset."],"exampleFix":"/* no source edit; project fix */\n// before: Player Settings > Default Icon empty / invalid texture -> AddIconsToBuild returns false\n// after: assign a valid readable Texture2D as Default Icon and per-platform icons, then rebuild","handlingStrategy":"validation","validationCode":"// Validate icons before building\nif (PlayerSettings.GetIconsForTargetGroup(buildTargetGroup).Any(t => t == null))\n    Debug.LogWarning(\"Some platform icons are unassigned; AddIconsToBuild may fail.\");","typeGuard":null,"tryCatchPattern":"try { PostprocessBuildPlayer.Postprocess(...); }\ncatch (BuildFailedException ex) when (ex.Message == \"Failed to add player icon\")\n{ Debug.LogError(\"Fix Player Settings icons and rebuild.\"); throw; }","preventionTips":["Assign a valid Default Icon and all platform icon slots in Player Settings.","Ensure icon textures are imported correctly (readable, correct sizes)."],"tags":["build-pipeline","postprocess","icons","player-settings"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}