Msw Sprite Ruid

作者 msw-git96133b2991d7無授權條款36 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫2 天前更新

SpriteRendererComponent.SpriteRUID (world) and SpriteGUIRendererComponent.ImageRUID (UI) — native RUID type support (sprite / animationclip direct playback), thumbnail:// prefix for rendering avataritem / skeleton / animationclip as static thumbnail image, avatar item icon in inventory / shop / UI slot. Use when: assigning any RUID to a sprite renderer component, displaying an avatar item or resource as a thumbnail or icon, using animationclip directly in a renderer, rendering inventory item icons, displaying a thumbnail image in a world entity. Keywords: SpriteRUID, ImageRUID, thumbnail://, animationclip, RUID apply, RUID assign, thumbnail, item icon, sprite RUID, RUID to renderer

AI 產生的概覽

為精靈渲染器元件指派 RUID 的規則,包含用於圖示的 thumbnail:// 前置字串。

功能
此技能說明如何為世界實體的 SpriteRendererComponent.SpriteRUID 與 UI 的 SpriteGUIRendererComponent.ImageRUID 指派 RUID。它介紹對 sprite 與 animationclip RUID 的原生支援、執行階段使用的 DataRef 形式,以及可將 sprite、animationclip、skeleton 或 avataritem 資源算繪為靜態縮圖的 thumbnail:// 前置字串。它也列出常見陷阱,例如 skeleton 或 avataritem RUID 未加前置字串時會無聲失敗。
適用情境
適用於將任意 RUID 指派給精靈渲染器元件、將虛擬角色物品或資源顯示為縮圖或圖示、在渲染器中直接使用 animationclip,以及算繪背包與商店物品圖示等情境。
執行需求
僅為說明文件,不含指令碼。假定環境具備 MSW 引擎元件與執行階段 .mlua,並引用獨立的 msw-search 技能來尋找 RUID。

MSW Sprite RUID

Rules for assigning a RUID to SpriteRendererComponent.SpriteRUID (world) or SpriteGUIRendererComponent.ImageRUID (UI).


Native type support

Both components accept a sprite or animationclip RUID directly — no extra animator component required.

ComponentPropertyValue form (runtime .mlua)Native RUID types
SpriteRendererComponent (world)SpriteRUIDplain stringsprite, animationclip
SpriteGUIRendererComponent (UI)ImageRUIDDataRef("...")sprite, animationclip

ImageRUID is a DataRef: in runtime .mlua, assign DataRef(ruid). Use { DataId: ruid } only in .ui / .model JSON or builder patch data. SpriteRUID remains a plain string.

lua
-- World: sprite or animationclip RUID both workself.Entity.SpriteRendererComponent.SpriteRUID = ruid
-- UI: sprite or animationclip RUID both workself.Entity.SpriteGUIRendererComponent.ImageRUID = DataRef(ruid)

A skeleton / avataritem RUID assigned without the thumbnail:// prefix fails silently (no error, nothing renders).


animationclip: single animation vs multi-state

  • Single looping animation (background deco, idle effect, prop): set SpriteRUID or ImageRUID directly to the animationclip RUID.
  • Multi-state (stand / move / attack / hit / die): use StateAnimationComponent + ActionSheet. See msw-general/references/monster.md.

thumbnail:// prefix — static thumbnail from any resource

Prepend thumbnail:// to SpriteRUID or ImageRUID to render a static thumbnail image from any resource — useful for icons, preview images, and item thumbnails.

thumbnail://<32-char hex RUID>

Accepted types: sprite · animationclip · skeleton · avataritem

lua
-- World thumbnail (any resource type)self.Entity.SpriteRendererComponent.SpriteRUID = "thumbnail://" .. anyRuid
-- UI thumbnail (any resource type)self.Entity.SpriteGUIRendererComponent.ImageRUID = DataRef("thumbnail://" .. anyRuid)

Primary use case: avataritem icons

avataritem RUIDs cannot render without thumbnail://. With the prefix they become item icons for inventory slots, shop listings, and equip previews.

lua
slotEntity.SpriteGUIRendererComponent.ImageRUID = DataRef("thumbnail://" .. avatarItemRuid)

Search avatar item RUIDs with the msw-search skill (searchAvatarItems).


Common pitfalls

  • skeleton / avataritem directly into SpriteRUID / ImageRUID without prefix → silently invisible.
  • thumbnail:// = static image only. For live animation, assign the animationclip RUID directly (no prefix).
  • Runtime .mlua uses ImageRUID = DataRef("..."); the { "DataId": "..." } object form is .ui / .model JSON only (the prefix goes inside DataId, not a separate field). Do not use the table form in runtime code — the LSP rejects it as a DataRef type mismatch.
  • CostumeManagerComponent.Custom*Equip, StateAnimationComponent.ActionSheet, and SkeletonRendererComponent.SkeletonRUID do not accept thumbnail://.
  • Do not prepend thumbnail:// to a RUID that was already retrieved as a thumbnail or icon image from msw-search. The prefix converts a source resource into its thumbnail — applying it to an already-thumbnail sprite is logically redundant. If the search query targeted an icon / thumbnail image and returned a sprite RUID, assign that RUID directly without any prefix.
  • To search for RUIDs use the msw-search skill — searchAvatarItems for avatar items; searchResources for everything else.

來源與署名

來源:msw-git/msw-ai-coding-plugins-official位於plugins/msw-maker-base-skill/skills/msw-sprite-ruid提交96133b2

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架