Fix Unity city coordinate conversion#60
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates WismUnity’s Unity↔game coordinate conversion so 2x2 city markers map back to the correct WismClient top-left tile, and adds a targeted PlayMode regression test to prevent the city-marker offset bug from returning.
Changes:
- Adjust
WorldTilemapto use a tilemap-awareConvertUnityToGameVectorimplementation and refactor click picking to accept an injected screen position. - Update
CityEntrycoordinate offset logic for centered 2x2 city markers and preserve runtime hiding of editor marker sprites. - Add a focused PlayMode test validating city marker top-left coordinate conversion.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WismUnity/Assets/Scripts/UnityGame/Mapping/WorldTilemap.cs | Routes Unity→game conversion through tilemap-aware utilities; adds GetTileAtScreenPosition. |
| WismUnity/Assets/Scripts/UnityGame/Editors/CityEntry.cs | Updates city marker coordinate offset logic; hides marker sprite at runtime on enable/awake. |
| WismUnity/Assets/Scripts/UnityGame/Common/MapUtilities.cs | Makes Unity→game conversion tilemap-aware using bounds/anchor and WorldToCell. |
| WismUnity/Assets/Scripts/Tests/PlayMode/CityEntryCoordinateTests.cs | Adds a PlayMode regression test for centered 2x2 city marker → top-left game coordinate. |
| WismUnity/Assets/Scripts/Tests/PlayMode/CityEntryCoordinateTests.cs.meta | Adds Unity meta for the new test script. |
Files not reviewed (1)
- WismUnity/Assets/Scripts/Tests/PlayMode/CityEntryCoordinateTests.cs.meta: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+11
to
+15
| private void Awake() | ||
| { | ||
| HideRuntimeMarkerSprite(); | ||
| } | ||
|
|
Comment on lines
+1
to
+2
| fileFormatVersion: 2 | ||
| guid: 97044d356fa34e6a8d698b17b32b2172 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation