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
- Frame Debugger's Hierarchy is not navigable when connecting it to the project built with the Volumetric Fog
- The number of SetPass Calls is increasing when attaching the Frame Debugger to the Player
- Scrollbar briefly appears in the Package Manager during installation process even when the package list is too short to require scrolling
- Script resets to use the previous Skybox color when saving the Scene changes
- [2D] Sprite Library Editor window throws NullReferenceException error when entering Play Mode with Game View maximised
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;