{"record":{"id":"b47a5bc89248072d","repo":"CoplayDev/unity-mcp","slug":"max-height-should-be-larger-than-0","errorCode":null,"errorMessage":"Max height should be larger than 0","messagePattern":"Max height should be larger than 0","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Previews/Scripts/Generators/Custom/TypeGenerators/TextureTypePreviewGenerator.cs","lineNumber":32,"sourceCode":"    {\r\n        private TextureTypeGeneratorSettings _settings;\r\n\r\n        public override event Action<int, int> OnAssetProcessed;\r\n\r\n        public TextureTypePreviewGenerator(TextureTypeGeneratorSettings settings) : base(settings)\r\n        {\r\n            _settings = settings;\r\n        }\r\n\r\n        public override void ValidateSettings()\r\n        {\r\n            base.ValidateSettings();\r\n\r\n            if (_settings.MaxWidth <= 0)\r\n                throw new ArgumentException(\"Max width should be larger than 0\");\r\n\r\n            if (_settings.MaxHeight <= 0)\r\n                throw new ArgumentException(\"Max height should be larger than 0\");\r\n        }\r\n\r\n        protected override IEnumerable<UnityEngine.Object> CollectAssets()\r\n        {\r\n            var textures = new List<UnityEngine.Object>();\r\n            var textureGuids = AssetDatabase.FindAssets(\"t:texture\", Settings.InputPaths);\r\n\r\n            foreach (var guid in textureGuids)\r\n            {\r\n                var texture = AssetDatabase.LoadAssetAtPath<Texture>(AssetDatabase.GUIDToAssetPath(guid));\r\n\r\n                // Skip nested textures\r\n                if (!AssetDatabase.IsMainAsset(texture))\r\n                    continue;\r\n\r\n                textures.Add(texture);\r\n            }\r\n\r","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/CoplayDev/unity-mcp/blob/c21bf496bca87d54e75bad048563c3adb1782081/TestProjects/AssetStoreUploads/Packages/com.unity.asset-store-tools/Editor/Previews/Scripts/Generators/Custom/TypeGenerators/TextureTypePreviewGenerator.cs#L14-L50","documentation":"Thrown by TextureTypePreviewGenerator.ValidateSettings when _settings.MaxHeight is zero or negative. MaxHeight caps the vertical dimension of texture previews. Validated immediately after MaxWidth in the same override.","triggerScenarios":"Calling Generate() or ValidateSettings() on a TextureTypePreviewGenerator with _settings.MaxHeight <= 0. MaxHeight feeds the resize logic during preview generation.","commonSituations":"Settings constructed with MaxWidth set but MaxHeight left at 0; deserialized config missing this field; partial settings clone.","solutions":["Set _settings.MaxHeight to a positive integer (e.g., 512 or 1024) before calling Generate.","Set MaxWidth and MaxHeight together in a settings factory.","Default unset dimension fields after deserialization."],"exampleFix":"// before\nvar settings = new TextureTypeGeneratorSettings { MaxWidth = 1024, MaxHeight = 0, InputPaths = paths, OutputPath = outPath };\n\n// after\nvar settings = new TextureTypeGeneratorSettings { MaxWidth = 1024, MaxHeight = 1024, InputPaths = paths, OutputPath = outPath };","handlingStrategy":"validation","validationCode":"if (settings.MaxHeight <= 0)\n    settings.MaxHeight = 1024; // sensible default\n// or validate:\nif (settings.MaxHeight <= 0)\n    throw new InvalidOperationException(\"Texture preview MaxHeight must be a positive value.\");","typeGuard":"static bool IsValidTexturePreviewDimensions(TextureTypeGeneratorSettings s)\n    => s.MaxWidth > 0 && s.MaxHeight > 0;","tryCatchPattern":"try\n{\n    await generator.Generate();\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Max height should be larger than 0\"))\n{\n    settings.MaxHeight = 1024;\n    await generator.Generate();\n}","preventionTips":["Initialize MaxWidth and MaxHeight in a single settings construction step.","Validate both max dimension fields before starting generation.","Apply default values after deserialization for unset fields."],"tags":["unity","asset-store-tools","preview","validation","texture"],"backgroundTag":null,"analyzedSha":"c21bf496bca87d54e75bad048563c3adb1782081","analyzedAt":"2026-08-13T17:36:56.095Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}