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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
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).