Search Issue Tracker
By Design
Votes
0
Found in
2021.3.23f1
2022.2.16f1
2023.1.0b13
2023.2.0a11
Issue ID
UUM-33959
Regression
No
Tilemap.GetTilesRangeNonAlloc generates an array of Tiles outside the given range
Reproduction steps:
1. Open the attached “My project.zip“ project
2. Open the “SampleScene” scene
3. Enter Play mode
4. Select “Tilemap” GameObect and observe “Start Position”, “End Position” and positions of the generated elements in “ddd” Script Component
Expected result: Generated Elements positions are between “Start Position” and “End Position”
Actual result: Generated Elements positions are not between “Start Position” and “End Position”
Reproducible with: 2021.3.23f1, 2022.2.16f1, 2023.1.0b13, 2023.2.0a11
Could not test with: 2020.3.47f1 (Errors in the Console)
Reproduced on: macOS Monterey 12.6 (Intel), Windows 10 (by the reporter)
Note: Also reproducible in Build
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Assets are created in the Package folders when creating assets via custom buttons in the Inspector window or other windows
- “Select” windows are named differently on Windows and macOS
- [Windows] No minimum “Select” window size
- Enabling “Editor Extension Authoring” in UI Builder doesn’t dirty the document and saving with shortcut doesn’t persist the state
- WebRequest.Create() function fails with "URI prefix is not recognized" errors when the project is built for Linux Standalone or Windows Dedicated Server
Resolution Note:
Hi,
As detailed in the Scripting API documention found at https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.GetTilesRangeNonAlloc.html, GetTilesRangeNonAlloc will begin at the given starting position and iterate through all available Z Positions, then through the X and Y positions until it reaches the ending position. This will scan all X positions above the start position up to the end position, which can be outside of given X values (see example at the bottom in Scripting API documentation).
If you want to get Tiles within the bounds, please use Tilemap.GetTilesBlockNonAlloc instead (https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.GetTilesBlockNonAlloc.html).