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
- Fix for 2022.3.X: Flickering of HDRP Directional Light shadows with DirectionalMixedCachedShadows when in an Entities Graphics rendered Subscene
- "Objects are trying to be loaded during a domain backup." errors on entering Playmode
- Transform Node does not have outputs when it is created
- Changing the Default Icon does not change the executable's icon when re-building the project
- Texture is stored upside down when using Blit
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).