I have a function that takes in the position of a tile on a Tilemap and sets the colour. If I do not replace the tile with a dynamically created one, it works just fine.

However, if I create a tile at runtime, set it's colour and add it to the tilemap, the tile does not change. In the preview window it appears black.

The function can be found below:

private void CreateTile(Vector3Int tilePosition)
    var tempTile = ScriptableObject.CreateInstance<Tile>();

    tempTile.flags = TileFlags.None;
    tempTile.color = Color.green;

    tilemap.SetTile(tilePosition, tempTile);

Any help would be appreciated, I have spent a few hours on this problem.


  • \$\begingroup\$ Are you using the 2D render pipeline by any chance? (Any chance you just forgot to add lights to the scene?) \$\endgroup\$ – qwyxivi Jun 28 at 18:12
  • \$\begingroup\$ @qwyxivi There is a 2D render pipeline? All I can find in the documentation are the Standard pipeline, the HDRP and the URP. The URP is recommended for 2D and has a couple 2D-only goodies like 2D lights, but it can just as well be used for 3D rendering. \$\endgroup\$ – Philipp Jun 28 at 18:47
  • \$\begingroup\$ @Philipp My bad, I meant the 2D rendering configuration of URP. \$\endgroup\$ – qwyxivi Jun 28 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.