Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Cannot set a RuleTile with SetTile (..., ...)

Discussion in '2D' started by Santako, Jan 26, 2022.

  1. Santako

    Santako

    Joined:
    Apr 13, 2018
    Posts:
    17
    Hi all,

    I have started a project few versions ago in which there exist a modular tile scenario. Player is able to create new tiles on click and, when I started the project I just simply used:

    Code (CSharp):
    1. ground.SetTile(new Vector3Int(x, y, 0), grass_rule);
    Beeing "ground" a "Tilemap" and "grass_rule" a "RuleTile".

    It worked perfectly before update but it seems that on newer versions it doesn't work anymore.
    Compiler says "you cannot convert UnityEngine.RuleTile UnityEngine.Tilemaps.TileBase".

    Which is the new method to make this work?

    Thank you
     
  2. Santako

    Santako

    Joined:
    Apr 13, 2018
    Posts:
    17
    Hi,

    Anyone knows the answer?

    Thank you
     
  3. VeteranXT

    VeteranXT

    Joined:
    Jul 9, 2021
    Posts:
    9
    Find Refrence of tilemap. Then "tilemap.SetTile(<RuleTile>, etc etc etc)
     
    Santako likes this.