Skip to content
Search/
CyberMax › Answers

How to show RPG item icons from one atlas in a Godot 4 inventory

Updated 2026-11-24 · Roblox and game developers · by CyberMax

Short answer

Keep all icons in one atlas PNG and create an AtlasTexture per icon (atlas = the PNG, region = the icon's rectangle); assign it to a TextureRect or Button. A lookup function from item id to region keeps your inventory data-driven, and Nearest filtering keeps 32x32 icons crisp when scaled.

  1. Import the atlas with Filter Nearest.
  2. Create an AtlasTexture, set atlas to the PNG and region to Rect2(x, y, 32, 32).
  3. Assign it to a TextureRect in your slot scene; set Expand Mode and Stretch Mode Keep Aspect Centered.
  4. Store item id → region in a dictionary or a JSON file.
  5. Show rarity with material tiers or a coloured slot frame.

Copy-paste code

GDScript: an icon from an atlas region

var atlas := preload("res://icons/atlas.png")
func icon(col: int, row: int) -> AtlasTexture:
    var t := AtlasTexture.new()
    t.atlas = atlas
    t.region = Rect2(col * 32, row * 32, 32, 32)
    return t

$Slot/TextureRect.texture = icon(3, 0)
Lootwren Icons icon

Lootwren Icons: 393 RPG item icons for every loot tier

from $5

Lootwren ships 393 32x32 icons with a ready LootwrenIcons.get_icon("ring_ruby") helper that returns the AtlasTexture, for $5.

Secure checkout · 14-day fix-or-refund if it doesn't work as described (terms)

Questions

Why not one PNG per icon?

You can; an atlas means one texture to load and fewer files to manage.

Free: the Roblox Starter Kit

7 free Luau modules (damage, pets, shop formatting, admin audit log, tycoon guards and more) plus 3 free calculators, then 5 short emails with the scripting fixes we see go wrong most often.

You get one email to confirm first. Then the kit, and 5 short emails over two weeks. One-click unsubscribe in every email; we never share your address.