Search Issue Tracker
Fixed in 2018.2.X
Votes
0
Found in
2017.3.0f3
Issue ID
1001136
Regression
No
[Tilemap] 2D Tiles do not rotate. Calling tileData.transform.SetTRS has no effect on the tile's rotation
How to reproduce:
1. Download attached project file and open "DemoScene" Scene
2. Enter Play Mode
3 Select "Build Wall" button and build a horizontal line of walls (you will notice that the correct tile is used in each grid (e.g. end wall, or middle wall) but they are rotated wrongly. The debug log is outputting the rotation value that it is trying to set them at)
Actual result: Calling tileData.transform.SetTRS(Vector3.zero, GetRotation(mask), Vector3.one); in GetTileData() has no effect on the tile's rotation. My tiles are always placed in their original/default rotation.
Reproduced with: 2017.2.1p3, 2017.3.1p1, 2018.1.0b7
Comments (1)
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
- Test Runner’s vertical scrollbar overlaps with the up and down arrows and upper toolbar tabs when the window is minimized
- The Input Field view is not updated when deleting lines of text
- The scrollbar does not respect empty lines in the Input Field
- “Texture Atlas Viewer“ button text overlaps another button when the UI Toolkit Debugger is narrowed
- Thresholds are no longer automatically calculated after deleting Motion fields in Blendtrees
St000
Feb 28, 2018 14:14
Solution from Unity QA for anyone googling:
The example here (https://docs.unity3d.com/Manual/Tilemap-ScriptableTiles-Example.html) is outdated and we will update it.
The issue here is tileData.transform returns a copy of the Matrix4x4 and since it is a struct, by doing tileData.transform.SetTRS() does not set the actual copy of the Matrix4x4 hold by tileData. The correct code should be
var m = tileData.transform;
m.SetTRS(Vector3.zero, GetRotation(mask), Vector3.one);
tileData.transform = m;