msw-sprite-ruid

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MSW Sprite RUID

MSW Sprite RUID

SpriteRendererComponent.SpriteRUID
(世界场景)或
SpriteGUIRendererComponent.ImageRUID
(UI界面)分配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 formNative RUID types
SpriteRendererComponent
(world)
SpriteRUID
plain string
sprite
,
animationclip
SpriteGUIRendererComponent
(UI)
ImageRUID
{ "DataId": "..." }
sprite
,
animationclip
lua
-- World: sprite or animationclip RUID both work
self.Entity.SpriteRendererComponent.SpriteRUID = ruid

-- UI: sprite or animationclip RUID both work
self.Entity.SpriteGUIRendererComponent.ImageRUID = { DataId = ruid }
A
skeleton
/
avataritem
RUID assigned without the
thumbnail://
prefix fails silently (no error, nothing renders).

两个组件均直接接受
sprite
animationclip
类型的RUID——无需额外的动画器组件。
组件属性值格式原生RUID类型
SpriteRendererComponent
(世界场景)
SpriteRUID
纯字符串
sprite
,
animationclip
SpriteGUIRendererComponent
(UI界面)
ImageRUID
{ "DataId": "..." }
sprite
,
animationclip
lua
-- 世界场景:sprite或animationclip类型的RUID均可生效
self.Entity.SpriteRendererComponent.SpriteRUID = ruid

-- UI界面:sprite或animationclip类型的RUID均可生效
self.Entity.SpriteGUIRendererComponent.ImageRUID = { DataId = ruid }
若未添加
thumbnail://
前缀直接分配
skeleton
/
avataritem
类型的RUID,会静默失败(无报错,无内容渲染)。

animationclip: single animation vs multi-state

animationclip:单动画与多状态

  • 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
    .

  • 单循环动画(背景装饰、 idle特效、道具):直接将
    SpriteRUID
    ImageRUID
    设置为
    animationclip
    类型的RUID。
  • 多状态(站立/移动/攻击/受击/死亡):使用
    StateAnimationComponent
    +
    ActionSheet
    。详见
    msw-general/references/monster.md

thumbnail://
prefix — static thumbnail from any resource

thumbnail://
前缀——从任意资源生成静态缩略图

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 = { DataId = "thumbnail://" .. anyRuid }
SpriteRUID
ImageRUID
前添加
thumbnail://
前缀,可将任意资源渲染为静态缩略图——适用于图标、预览图和物品缩略图。
thumbnail://<32位十六进制RUID>
支持的资源类型:
sprite
·
animationclip
·
skeleton
·
avataritem
lua
-- 世界场景缩略图(任意资源类型)
self.Entity.SpriteRendererComponent.SpriteRUID = "thumbnail://" .. anyRuid

-- UI界面缩略图(任意资源类型)
self.Entity.SpriteGUIRendererComponent.ImageRUID = { DataId = "thumbnail://" .. anyRuid }

Primary use case: avataritem icons

主要使用场景:Avatar物品图标

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 = {
    DataId = "thumbnail://" .. avatarItemRuid,
}
Search avatar item RUIDs with the
msw-search
skill (
searchAvatarItems
).

avataritem
类型的RUID必须添加
thumbnail://
前缀才能渲染。添加前缀后,它们可作为背包槽位、商店列表和装备预览中的物品图标。
lua
slotEntity.SpriteGUIRendererComponent.ImageRUID = {
    DataId = "thumbnail://" .. avatarItemRuid,
}
使用
msw-search
技能(
searchAvatarItems
)搜索Avatar物品的RUID。

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).
  • ImageRUID
    prefix goes inside
    DataId
    :
    { "DataId": "thumbnail://..." }
    — not a separate field.
  • 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.
  • 未添加前缀直接将
    skeleton
    /
    avataritem
    类型的RUID赋值给
    SpriteRUID
    /
    ImageRUID
    → 静默不显示。
  • thumbnail://
    仅用于生成静态图片。若需实时动画,请直接分配
    animationclip
    类型的RUID(无需前缀)。
  • ImageRUID
    的前缀需放在
    DataId
    内部:
    { "DataId": "thumbnail://..." }
    ——而非单独字段。
  • CostumeManagerComponent.Custom*Equip
    StateAnimationComponent.ActionSheet
    SkeletonRendererComponent.SkeletonRUID
    不支持
    thumbnail://
    前缀。
  • 请勿对已通过
    msw-search
    获取的缩略图或图标图片RUID添加
    thumbnail://
    前缀。该前缀用于将源资源转换为缩略图——对已为缩略图的sprite添加前缀在逻辑上是冗余的。若搜索目标为图标/缩略图并返回
    sprite
    类型的RUID,请直接分配该RUID,无需添加任何前缀。
  • 如需搜索RUID,请使用
    msw-search
    技能——
    searchAvatarItems
    用于搜索Avatar物品;
    searchResources
    用于搜索其他所有资源。