Logo Ue Core Types And Containers

Ue Core Types And Containers

Cộng đồng
kevinpbuckley
ue-core-types-and-containers

Use Unreal's core C++ types instead of the standard library — containers (TArray, TMap, TSet, TQueue, TArrayView), string types (FString, FName, FText, TStringBuilder) with conversion patterns and localization rules, math types (FVector, FRotator, FQuat, FTransform) with Large World Coordinates (LWC/double precision), and utility types (TOptional, TVariant, TTuple). Use when writing any UE C++ that stores collections, manipulates strings, does 3D math, or when choosing between FString/FName/ FText, between std:: and UE containers, or between FRotator and FQuat for rotation.

Tổng quan

Nhà phát hànhkevinpbuckley
Kho mãunreal-engine-skills
Tên kỹ năngue-core-types-and-containers
Sao
89
Bản fork
9
Tệp đi kèm
4
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 4 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được kevinpbuckley công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Ue Core Types And Containers trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-core-types-and-containers
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kevinpbuckley/unreal-engine-skills.git /tmp/unreal-engine-skills
mkdir -p .claude/skills
cp -r /tmp/unreal-engine-skills/skills/core/ue-core-types-and-containers .claude/skills/ue-core-types-and-containers
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Ue Core Types And Containers trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Ue Core Types And Containers ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Ue Core Types And Containers với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Core types & containers

Unreal ships its own containers, string types, and math types. Use them, not std::: they integrate with UObject reflection, serialization, allocators, and garbage collection. Mixing in std::string or std::vector causes friction and these types won't serialize or reflect correctly.

When to use this skill

  • Storing collections: choose TArray/TMap/TSet over std::vector/std::map/std::set.
  • String work: pick FString (mutable), FName (identifier), or FText (user-facing / localized).
  • 3D math: FVector, FRotator, FQuat, FTransform, and FMath helpers.
  • Reaching for std::optional, std::variant, or std::tuple: use TOptional, TVariant, TTuple.
  • Thread-safe producer/consumer: TQueue over a locked TArray.

Containers at a glance

TypeUse forKey property
TArray<T>dynamic array (default container)contiguous, owning, serializable
TMap<K,V>key→valuehashed, unique keys, O(1) avg lookup
TSet<T>unique sethashed, O(1) avg membership test
TQueue<T>FIFO, cross-threadlock-free SPSC/MPSC
TArrayView<T>non-owning read-only windowzero-copy; pass over contiguous data
TArray<T, TInlineAllocator<N>>small array, avoid heapN elements on stack, spills to heap

TArray — the default container

cpp
TArray<FVector> Waypoints;
Waypoints.Reserve(64);                          // pre-size; avoids reallocations
Waypoints.Emplace(100.0, 200.0, 0.0);          // construct in-place; prefer over Add
Waypoints.Emplace(300.0, 400.0, 0.0);

for (const FVector& W : Waypoints) { /* ... */ }

// Predicate removal — no iterator invalidation
Waypoints.RemoveAll([](const FVector& V){ return V.Z < 0.0; });

// O(1) removal when order doesn't matter
Waypoints.RemoveAtSwap(0);

// Sort with a predicate
Waypoints.Sort([](const FVector& A, const FVector& B){ return A.X < B.X; });

GC rule: a TArray of UObject pointers stored as a member must be a UPROPERTY():

cpp
UPROPERTY()
TArray<TObjectPtr<AActor>> Spawned;  // GC keeps entries alive

TMap

cpp
TMap<FName, int32> Scores;
Scores.Reserve(32);
Scores.Add(TEXT("Alice"), 10);

// Idiomatic lookup — returns V* (null if missing)
if (int32* S = Scores.Find(TEXT("Alice")))
    (*S)++;

// Insert or get existing
int32& BobScore = Scores.FindOrAdd(TEXT("Bob"));  // inserts 0 if absent

// Iterate pairs
for (const TPair<FName, int32>& P : Scores)
    UE_LOG(LogGame, Log, TEXT("%s=%d"), *P.Key.ToString(), P.Value);

TSet

cpp
TSet<FName> Visited;
Visited.Add(TEXT("Level_A"));          // no-op if already present
bool bSeen = Visited.Contains(TEXT("Level_A"));  // O(1)
Visited.Remove(TEXT("Level_A"));

TQueue (thread-safe FIFO)

cpp
TQueue<FHitResult> PendingHits;   // SPSC by default
PendingHits.Enqueue(Hit);         // producer (can be off game thread)

FHitResult Out;
while (PendingHits.Dequeue(Out))  // consumer (game thread)
    ProcessHit(Out);

See references/containers.md for TArrayView, allocators, iteration patterns, and GC/UPROPERTY rules.

Strings: choose the right type

TypeMutable?PurposeCompare cost
FNamenoidentifiers, keys, asset names, bone/socket namesO(1), case-insensitive
FStringyesruntime build/parse/format; not for player-facing textO(n)
FTextn/alocalized user-facing textuse EqualTo() not ==
cpp
FName   Socket = TEXT("hand_r");                            // interned identifier
FString Path   = FString::Printf(TEXT("/Game/%s"), *Map);   // runtime manipulation
FText   Label  = NSLOCTEXT("UI", "Start", "Start Game");    // localized display
FText   HpText = FText::Format(
    NSLOCTEXT("UI", "HpFmt", "HP: {0}/{1}"),
    FText::AsNumber(Hp), FText::AsNumber(MaxHp));

Key conversions

cpp
FString S = Name.ToString();           // FName → FString
FName   N = FName(*SomeFString);       // FString → FName  (case-insensitive; lossy)
FText   T = FText::FromString(S);      // FString → FText  (not localizable; debug only)
bool bSame = TextA.EqualTo(TextB);     // FText equality — never operator==

TStringBuilder — efficient string building

Prefer TStringBuilder<N> over repeated += on FString. The N-character stack buffer avoids heap allocation for most outputs.

cpp
TStringBuilder<256> B;
B << TEXT("Actor=") << *Actor->GetName();
B.Appendf(TEXT(" X=%.1f"), Loc.X);
FString Result(B);

TStringBuilder<N> is the alias defined at Containers/StringFwd.h:32 for TStringBuilderWithBuffer<TCHAR, N> (Misc/StringBuilder.h:496).

See references/strings-and-text.md for the full conversion matrix, FStringView, string tables, encoding rules, and NSLOCTEXT vs LOCTEXT.

Math types (UE5 = double precision everywhere)

All primary math types are double in UE5 (Large World Coordinates). Float variants (FVector3f, FQuat4f, etc.) exist for rendering/physics payloads.

TypeMeaning
FVector3D point/direction (double X,Y,Z); TVector<double>
FRotatorpitch/yaw/roll in degrees; intuitive but prone to gimbal lock
FQuatquaternion; compose/interpolate rotations without gimbal lock
FTransformlocation + rotation + scale; the actor/component transform
FVector2D, FVector42D and 4D variants
FMatrix4×4 double matrix
FBox, FBoxSphereBoundsaxis-aligned bounds, sphere bounds
FIntVector, FIntPointinteger vector/point
cpp
FVector Loc  = Actor->GetActorLocation();
FVector Fwd  = Actor->GetActorForwardVector();
double  Dist = FVector::Dist(A, B);           // Dist:1017

FQuat Q    = Actor->GetActorQuat();
FQuat Rot  = FQuat(FVector::UpVector, FMath::DegreesToRadians(45.0));
FQuat Comp = Q * Rot;                         // compose: apply Q then Rot

FQuat Blended = FQuat::Slerp(Q, Target, Alpha); // smooth interpolation

FTransform T = Actor->GetActorTransform();
FVector LocalPt = T.InverseTransformPosition(WorldPt);

// FMath helpers
float Clamped   = FMath::Clamp(Val, 0.f, 1.f);
float Lerped    = FMath::Lerp(A, B, Alpha);
float Smoothed  = FMath::FInterpTo(Current, Target, DeltaTime, Speed);

Gimbal-lock rule: use FRotator for editor-facing properties and single-axis tweaks; use FQuat whenever composing or interpolating multiple rotations in code.

See references/math-types.md for per-type APIs, LWC pitfalls, FMath reference, and version notes.

Utility types

cpp
// TOptional<T> — maybe-a-value, no heap
TOptional<FHitResult> MaybeHit = DoTrace(Start, End);
if (MaybeHit.IsSet())
    Process(MaybeHit.GetValue());

// TVariant<A,B,...> — type-safe discriminated union
using FGameEvent = TVariant<FPickupEvent, FDamageEvent>;
FGameEvent Ev;
Ev.Set<FPickupEvent>({Actor});
if (FPickupEvent* P = Ev.TryGet<FPickupEvent>()) { /* ... */ }

// TTuple<A,B,...> — heterogeneous fixed-size tuple
TTuple<FString, int32> NameScore = MakeTuple(TEXT("Alice"), 100);
FString Name  = NameScore.Get<0>();
int32   Score = NameScore.Get<1>();

// TPair<K,V> — produced by TMap iteration
for (const TPair<FName, int32>& P : ScoreMap) { /* P.Key, P.Value */ }

See references/utility-types.md for usage rules, Get vs TryGet, C++17 structured bindings, and when to prefer a named struct over TTuple.

Gotchas

  • std::string/std::vector in UE C++ — avoid; they skip reflection/serialization and don't interact with GC. Use FString/TArray.
  • Missing TEXT() around literals — produces narrow char*; implicit conversion may silently mangle non-ASCII characters.
  • TMap::Find returns a pointer (null if absent) — always null-check before dereferencing. operator[] asserts if the key is missing.
  • Holding a pointer into a TArray across an Add — Add may reallocate; previously obtained GetData() pointers or element references are then invalid.
  • FName is case-insensitive — FName("Hand_R") == FName("hand_r"); never use it where case matters.
  • FText equality is EqualTo(), not == — operator== compares internal identity, not display strings.
  • FVector components are double — assigning .X to a float variable narrows. Use (float)V.X explicitly when interfacing with float-only APIs.
  • Composing rotations with FRotator + — does not produce correct multi-axis results; use FQuat multiplication instead.
  • TOptional::GetValue() on an unset optional — runtime check failure; call IsSet() first, or use Get(DefaultValue).
  • TQueue is not iterable — it is write-only from the producer side and dequeue-only from the consumer side; no Num() or range-for.

Version notes

  • UE5+: All primary math types are double (Large World Coordinates / LWC). Float variants (FVector3f, FRotator3f, FTransform3f, FQuat4f) exist for rendering and physics payloads; do not mix with double variants without explicit conversion.
  • UE 5.3: TWriteToString<N> deprecated; use TStringBuilder<N>.
  • UE 5.5+: TSet may internally use TCompactSet; the public API is unchanged.

References & source material

Engine source (UE 5.8, under Engine/Source/Runtime/Core/Public/):

  • Containers/Array.h:767 — TArray<T> template class; Contains:1757, Reserve:3268, Sort:3654.
  • Containers/Map.h (via Map.h.inl) — TMap<K,V>; uses sparse-array + hash bucket backing.
  • Containers/Set.h — TSet<T>.
  • Containers/Queue.h:47 — TQueue<T>, Enqueue:123, Dequeue:80, IsEmpty:206.
  • Containers/ArrayView.h — TArrayView<T>.
  • Containers/ContainerAllocationPolicies.h:1328 — TInlineAllocator; :1530 — TFixedAllocator.
  • Containers/StaticArray.h:25 — TStaticArray<T,N>.
  • Containers/UnrealString.h (impl in UnrealString.h.inl:58) — FString; Printf:1376, Format:1418, FromInt:1992.
  • Containers/StringFwd.h:23 — FStringBuilderBase; :32 — TStringBuilder<N> alias.
  • Misc/StringBuilder.h:78 — TStringBuilderBase; Append:238, Appendf:407.
  • UObject/NameTypes.h:631 — FName; ToString:697.
  • Internationalization/Text.h:406 — FText; Format:675, FromString:520, EqualTo:599, AsNumber:428.
  • Misc/Optional.h:47 — TOptional<T>; IsSet:359, GetValue:370, Get:407.
  • Misc/TVariant.h:42 — TVariant<T,Ts...>; IsType:124, Get:132, TryGet:160.
  • Templates/Tuple.h:531 — TTuple<...>; MakeTuple:45, Get<N>():245.
  • Math/MathFwd.h:47 — type aliases: FVector, FQuat:50, FTransform:53, FRotator:57.
  • Math/Vector.h:50 — TVector<T>; Dist:1015, DotProduct:263, CrossProduct:238, GetSafeNormal:647, Normalize:630.
  • Math/Quat.h:38 — TQuat<T>; Slerp:658, MakeFromEuler:374.
  • Math/TransformVectorized.h:61 — TTransform<T>; GetLocation:599, GetScale3D:1237, TransformPosition:562, InverseTransformPosition:567.
  • Math/UnrealMathUtility.h — FMath; Clamp:592, Lerp:1123, FInterpTo:1509, FInterpConstantTo:1490, RandRange:289.

Official docs (UE 5.8):

Deep-dive references in this skill:

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Ue Core Types And Containers làm được gì?

Use Unreal's core C++ types instead of the standard library — containers (TArray, TMap, TSet, TQueue, TArrayView), string types (FString, FName, FText, TStringBuilder) with conversion patterns and localization rules, math types (FVector, FRotator, FQuat, FTransform) with Large World Coordinates (LWC/double precision), and utility types (TOptional, TVariant, TTuple). Use when writing any UE C++ that stores collections, manipulates strings, does 3D math, or when choosing between FString/FName/ FText, between std:: and UE containers, or between FRotator and FQuat for rotation.

Vì sao nên dùng Ue Core Types And Containers trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Ue Core Types And Containers là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Ue Core Types And Containers trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-core-types-and-containers. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Ue Core Types And Containers?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Ue Core Types And Containers với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Ue Core Types And Containers với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Ue Core Types And Containers có miễn phí không?

Kỹ năng này được kevinpbuckley phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇