Skip to content

Improve heightmap import error message#93

Merged
BlackYps merged 1 commit intomasterfrom
heightmap-import
Nov 22, 2025
Merged

Improve heightmap import error message#93
BlackYps merged 1 commit intomasterfrom
heightmap-import

Conversation

@BlackYps
Copy link
Copy Markdown

@BlackYps BlackYps commented Nov 22, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error messaging for heightmap imports. When file sizes don't match expected dimensions, users now receive clearer guidance including specific size requirements and helpful examples to correctly prepare their heightmap files.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 22, 2025

Walkthrough

A single error message in the heightmap import validation is improved to provide clearer guidance on heightmap size requirements, clarifying that heightmaps must be map size plus one pixel.

Changes

Cohort / File(s) Summary
Error message enhancement
Assets/Scripts/UI/Tools/Terrain/TerrainInfo.cs
Updated ImportHeightmap error message for mismatched heightmap file size to include helpful guidance about the map-size-plus-one requirement (e.g., 513px for a 512-sized map)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify the error message text is clear and grammatically correct
  • Confirm the example value (513px) aligns with typical heightmap conventions

Poem

🐰 A message once cryptic, now shines ever clear,
"Map size plus one!" the heightmaps now hear,
Five-thirteen pixels, no mystery here,
The rabbit hops on, with improved atmosphere! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Improve heightmap import error message' directly and clearly describes the main change in the pull request, which updates the error message shown when importing heightmaps with incorrect file sizes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch heightmap-import

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b961e16 and 725eed1.

📒 Files selected for processing (1)
  • Assets/Scripts/UI/Tools/Terrain/TerrainInfo.cs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
Assets/Scripts/UI/Tools/Terrain/TerrainInfo.cs (1)
Assets/Scripts/UI/GenericPopups/GenericPopup.cs (2)
  • GenericPopup (9-164)
  • ShowPopup (68-84)

reader.Dispose();
file.Dispose();
GenericPopup.ShowPopup(GenericPopup.PopupTypes.Error, "Error", "Selected heightmap is in wrong size.\nIs: " + FileLength + "B, should be: " + CheckValue + "B", "OK", null);
GenericPopup.ShowPopup(GenericPopup.PopupTypes.Error, "Error", "Selected heightmap has wrong size. Remember that heightmaps need to be map size plus one. E.g. 513px.\nFilesize is: " + FileLength + " Byte, should be: " + CheckValue + " Byte.", "OK", null);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Excellent improvement to the error message clarity!

The new message provides much better guidance to users by explaining the heightmap size requirement and giving a concrete example. This will significantly reduce user confusion.

Minor grammatical fix needed: "Byte" should be "bytes" (plural) since the file sizes will always be greater than 1.

Apply this diff:

-						GenericPopup.ShowPopup(GenericPopup.PopupTypes.Error, "Error", "Selected heightmap has wrong size. Remember that heightmaps need to be map size plus one. E.g. 513px.\nFilesize is: " + FileLength + " Byte, should be: " + CheckValue + " Byte.", "OK", null);
+						GenericPopup.ShowPopup(GenericPopup.PopupTypes.Error, "Error", "Selected heightmap has wrong size. Remember that heightmaps need to be map size plus one. E.g. 513px.\nFilesize is: " + FileLength + " bytes, should be: " + CheckValue + " bytes.", "OK", null);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GenericPopup.ShowPopup(GenericPopup.PopupTypes.Error, "Error", "Selected heightmap has wrong size. Remember that heightmaps need to be map size plus one. E.g. 513px.\nFilesize is: " + FileLength + " Byte, should be: " + CheckValue + " Byte.", "OK", null);
GenericPopup.ShowPopup(GenericPopup.PopupTypes.Error, "Error", "Selected heightmap has wrong size. Remember that heightmaps need to be map size plus one. E.g. 513px.\nFilesize is: " + FileLength + " bytes, should be: " + CheckValue + " bytes.", "OK", null);
🤖 Prompt for AI Agents
In Assets/Scripts/UI/Tools/Terrain/TerrainInfo.cs around line 698, the error
message uses the singular "Byte" twice though file sizes will be plural; update
the string literals to use "bytes" (e.g. change " Byte" to " bytes") so the
message reads "...Filesize is: " + FileLength + " bytes, should be: " +
CheckValue + " bytes." leaving the rest of the message intact.

@BlackYps BlackYps merged commit 36f430c into master Nov 22, 2025
1 check passed
@BlackYps BlackYps deleted the heightmap-import branch November 22, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant