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
- ArgumentOutOfRangeException when manipulating the Project Settings search bar
- [Linux] Touch freezes in Player when any mouse button is clicked
- UnityEngine.Rendering.Volume.OnEnable() is called twice before OnDisable() creating multiple copies of the same volume when a volume is enabled right after Domain Reload when entering Play Mode
- Hinge Joint transforms are reset when toggling the "useMotor" property
- Motion Vector texture reports incorrect Mesh data when Mesh is coming from off-screen
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;