Can TextureButton nodes use TileSet sprites?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By nicfer
:warning: Old Version Published before Godot 3 was released.
:bust_in_silhouette: Reply From: Kamil Lewan
textureButtonObj.set_normal_texture(preload("res://path_to_tileSET").tile_get_texture(ID))

Remember that:

  • you should get/set scale too (that’s no auto)
  • buttons have few textures (normal, hower, focused, disabled, pressed)
  • you may get your tileSET from tileMAP by get_node("tileMap").get_tileset()
  • if tiles have regions you must use regions to texture
  • you must know ID of tile in tileset