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
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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;