npx claudepluginhub 15195999826/lomomarketplace --plugin UE_ReactUMGWant just this skill?
Then install: npx claudepluginhub u/[userId]/[slug]
ReactUMG TArray/数组属性处理指南。在传递数组给 UE 组件、使用 GridPanel 的 ColumnFill/RowFill、或遇到"不能用 JS 数组"问题时激活。必须用 UE.NewArray() 创建原生数组,包含 BuiltinFloat/String/Int 等类型常量。
This skill uses the workspace's default tool permissions.
ReactUMG TArray 属性处理
核心规则
TArray 属性必须使用 UE.NewArray(),不能直接使用 JS 数组!
// ❌ 错误:直接使用 JS 数组
<GridPanel ColumnFill={[1, 1, 1]} /> // Type Error!
// ✅ 正确:使用 UE.NewArray()
const columnFill = UE.NewArray(UE.BuiltinFloat);
columnFill.Add(1, 1, 1);
<GridPanel ColumnFill={columnFill} />
Builtin 类型常量表
| 常量 | TypeScript 类型 | 用途 |
|---|---|---|
UE.BuiltinFloat | number | 最常用 - GridPanel 的 Fill 值 |
UE.BuiltinInt | number | 整数值 |
UE.BuiltinString | string | 字符串 |
UE.BuiltinBool | boolean | 布尔值 |
UE.BuiltinByte | number | 0-255 整数 |
实际示例:GridPanel
import * as UE from 'ue';
class MyPanel extends React.Component {
// 静态创建(推荐)
private static readonly COLUMN_FILL = (() => {
const arr = UE.NewArray(UE.BuiltinFloat);
arr.Add(1, 1, 1); // 3 列等宽
return arr;
})();
render() {
return (
<GridPanel ColumnFill={MyPanel.COLUMN_FILL}>
{/* items */}
</GridPanel>
);
}
}
TArray 常用方法
const arr = UE.NewArray(UE.BuiltinFloat);
arr.Add(1, 2, 3); // 添加多个值
arr.Get(0); // 获取值(不要用 arr[0]!)
arr.Set(0, 10); // 设置值
arr.Num(); // 获取长度
arr.RemoveAt(0); // 删除
arr.Empty(); // 清空
为什么不能用 JS 数组?
PuerTS 的 TArray 类型定义使用 [index: number]: never 来阻止直接下标访问,强制使用 .Get()/.Set() 方法,确保类型安全。
Similar Skills
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.