Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Unable to see my scripted tile in my tile palette?

Discussion in '2D' started by FredBugg, Mar 19, 2023.

  1. FredBugg

    FredBugg

    Joined:
    Nov 25, 2013
    Posts:
    4
    Hello!

    I'm using this tutorial to make scripted tile so I can get a bit more flexibility than what the Rule Tiles provide. The problem is, after I create my tile and drag it into the palette, nothing is actually appearing there. That being said, if I delete the tile I just created, the pinkish placeholder tile image shows up in the palette, so the tile is actually being set, it's just not visible.

    At approximately 28:00, guy in the video sets the sprite of his tile and drags it in no problem, but I just can't replicate his success. Would anyone know what could be the issue here?
     
  2. vonchor

    vonchor

    Joined:
    Jun 30, 2009
    Posts:
    249
    You might note that Rule Tiles derive from TileBase and not Tile.

    Tile has a sprite property and the Tilemap gets the sprite reference from that.

    Basic rule tiles don't have the Sprite property but have a field called m_DefaultSprite and this one assumes that the Tilemap code knows this or there's some other sort of adaptation (it's opaque in the C++ engine so we can only guess).

    The palette view is actually a Scene with a Tilemap in it.

    So if your tile isn't showing a sprite but it is there then that's probably because when you created the rule tile asset you didn't poke the default sprite into the field in the asset (in the proj folder).

    My best guess at the moment w/o any other info.

    Good luck!
     
  3. FredBugg

    FredBugg

    Joined:
    Nov 25, 2013
    Posts:
    4
    Thanks for the answer!

    Are you referring to dragging the sprite into the sprite field in the tile asset's inspector window? If so, I did do that to no avail unfortunately!
     
  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Hi, it is likely that in
    TileBase.GetTileData
    of your custom Tile, the Sprite is not filled or set to null. Could you share how you fill in the Sprite for your Tile?
     
  5. FredBugg

    FredBugg

    Joined:
    Nov 25, 2013
    Posts:
    4
    This was it! I set the sprite to the first of the sprite array and it works now. Thank you!
     
  6. abinavsundhar175

    abinavsundhar175

    Joined:
    Oct 24, 2023
    Posts:
    1
    Tile has a sprite property and the Tilemap gets the sprite reference from that.

    Basic rule tiles don't have the Sprite property but have a field called m_DefaultSprite and this one assumes that the Tilemap code knows this or there's some other sort of adaptation (it's opaque in the C++ engine so we can only guess).

    The palette view is actually a Scene with a Tilemap in it.

    So if your tile isn't showing a sprite but it is there then that's probably because when you created the rule tile asset you didn't poke the default sprite into the field in the asset (in the proj folder).

    Can't understand can you help me with it.