Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.
中文简介正在准备中。当前显示原文说明。
Sets up and configures Unity Localization, including locales, String/Asset Tables, CJK font support, and Addressables workflows. Use when the user wants to add languages to a project, translate UI text, support Asian (CJK) languages with TMP fonts, or mentions i18n, l10n, multilingual support, or making a game support multiple languages.
中文简介正在准备中。当前显示原文说明。
实测评分 未实测
查看安装方法安装前可以查看交给 AI 代理的指令内容。
This guide covers setting up and configuring Unity Localization, including locales, String and Asset Tables, Addressables integration, and CJK font support via Asset Tables.
Before doing anything else, verify that the Localization packages is installed. Many APIs in this skill will fail silently or throw confusing errors if the package isn't present.
UnityEditor.PackageManager.Client.List(true) to check for com.unity.localization.Client.Add("com.unity.localization").Client.List confirms installation.If LocalizationEditorSettings.ActiveLocalizationSettings is null, you must find or create it:
AssetDatabase.FindAssets("t:LocalizationSettings"). If found, load the first one and assign it to LocalizationEditorSettings.ActiveLocalizationSettings.Assets/Localization/LocalizationSettings.asset. Use ScriptableObject.CreateInstance<LocalizationSettings>() followed by AssetDatabase.CreateAsset().LocalizationEditorSettings.ActiveLocalizationSettings = settings.LocalizationEditorSettings.AddLocale(locale).Programmatic changes to String or Asset tables require notification to the Editor. Always create the required asset tables, unless there is already an existing one in the project.
When populating tables from a dataset, match by Locale.Identifier.Code explicitly. The order of GetLocales() is not guaranteed to match your input data array — assuming it does will cause silent data mismatches that are very hard to debug.
For Asset Tables, use the GUID of the asset: table.GetEntry(sharedId) ?? table.AddEntry(sharedId, guid);.
After any modification (adding keys, updating values), notify the Editor so it can refresh its internal state. Skipping this will leave the Editor showing stale data until the next reimport.
EditorUtility.SetDirty(collection), EditorUtility.SetDirty(collection.SharedData), on each modified Table.LocalizationEditorSettings.EditorEvents.RaiseCollectionModified(sender, collection);AssetDatabase.SaveAssets() at the end.UnityEngine.UI.Image, UnityEngine.UI.VerticalLayoutGroup, UnityEngine.UI.ScrollRect, UnityEngine.UI.Mask, UnityEngine.UI.CanvasScaler, UnityEngine.UI.GraphicRaycaster, UnityEngine.UI.ContentSizeFitter, UnityEngine.UI.LayoutRebuilder, etc.UnityEngine.UI is both a namespace and a class container, so unqualified names produce CS0118 (namespace used like a type). Full qualification avoids this entirely.GameObject.Find("YourCanvasName") and destroy the old one before creating a new one.Check Component Type: Identify if the target is TextMeshPro or legacy UnityEngine.UI.Text.
Bind Correctly: add the public UnityEngine.Localization.Components.LocalizeStringEvent
component and wire it yourself — set StringReference to the table entry, then add an
OnUpdateString listener that assigns the value to the text component (TMP_Text.text for
TextMeshPro, UnityEngine.UI.Text.text for legacy Text).
Do not reflect into UnityEditor.Localization.Plugins.TMPro.LocalizeComponent_TMPro or its
UGUI counterpart. Those are internal (measured on Localization 1.5.12), so reaching them means
routing around access control to reach an API Unity makes no stability commitment about — it can
change or disappear in any package release. LocalizeStringEvent is public and does the same job
with the wiring made explicit.
Layout Rebuild: After setting localized text or populating a list, call UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(parentTransform) to ensure dimensions update.
Avoid TMP Fallback Fonts for CJK locales. Use Asset Table Font Swapping for each specific locale instead — fallbacks are unreliable and hard to debug when glyphs are missing.
msyh.ttc (Microsoft YaHei) or equivalent.msgothic.ttc (MS Gothic) or equivalent.malgun.ttf (Malgun Gothic) or equivalent.TMP_FontAsset from imported fonts.fontAsset.atlasPopulationMode = AtlasPopulationMode.Dynamic;fontAsset.isMultiAtlasTexturesEnabled = true;AssetDatabase.AddObjectToAsset(fontAsset.atlasTexture, fontAsset);.
fontAsset.material.mainTexture = fontAsset.atlasTexture; and set both as dirty before saving.Resources/ folder in an Asset Table. This causes OperationException: Failed to load sub-asset errors. If an asset is in Resources/, copy it to Assets/Fonts/ or similar before making it Addressable.LocalizedTmpFont over LocalizedAsset<TMP_FontAsset> to avoid implicit conversion errors.AddressableAssetSettings.BuildPlayerContent();.Before concluding any CJK localization task:
zh-Hans, ja, and ko. Inspect the UI. If any characters appear as squares (tofu), the font setup has FAILED.AssetTable for the CJK locale points to the correct CJK TMP_FontAsset, NOT a default Western font.isMultiAtlasTexturesEnabled is true on the CJK font assets.VerticalLayoutGroup with Child Control Height: True, Child Force Expand Height: False.ContentSizeFitter set to Vertical Fit: Preferred Size.Enable Word Wrapping: True and Overflow: Overflow.L10n) to wrap LocalizationSettings.StringDatabase.GetLocalizedString for easy injection into existing scripts.LocalizeStringEvent via script, avoid UnityEventTools.AddPersistentListener as it often fails to set the dynamic mode (Mode 0) correctly.
Instead, use the SerializedObject Pattern described in Section 3 to explicitly set m_MethodName to set_text and m_Mode to 0. Persistent listeners MUST point to a method on a UnityEngine.Object; lambdas will fail.LocalizationEditorSettings.CreateStringTableCollection expects a directory path (e.g., Assets/Localization), not a full asset path.lEvent.RefreshString() after assigning a LocalizedString reference programmatically to update the UI immediately.using System.Linq; when searching collections and using UnityEngine.Localization; when working with locales or tables.AddressableAssetSettings.BuildPlayerContent() and switch the Editor locale to verify changes. Check LocalizationSettings.Instance status after activation.To efficiently translate an existing project, follow this multi-step workflow:
Extraction & Component Setup:
UnityEngine.UI.Text, TextMeshPro, buttons, etc.).UIStrings) with the base language and a "Context" column for each key to guide translators.LocalizeStringEvent (for text) and a LocalizedFont helper (for font swapping).EditorAndRuntime) so they update in the Editor immediately when the locale changes.Context-Aware Translation:
Quality Assurance (QA):
Window > Asset Management > Localization Scene Controls or script: LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.GetLocale("de");.ContentSizeFitter if strings are too long.For detailed API usage, common namespace conflicts, Addressables patterns, and font repair steps, see references/api-notes.md.
To localize an entire project efficiently, use a batch processing script that handles all scenes in one pass.
Ask before acting: Before running any batch operation, confirm with the user:
"This will open every scene in the project, attach
LocalizeStringEventcomponents, and save all modified scenes. This cannot be undone automatically. Shall I proceed?"
Only proceed once the user has confirmed. The batch processor template is in resources/L10nBatchProcessor.cs.
TableReference names (strings) instead of GUIDs — they are easier to read and maintain.LocalizationSettings.Instance.ForceRefresh() after modifications to force the UI to update in the editor.GameAssets table once and use a script to re-assign LocalizeFontEvent to all labels in one pass.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Refactor bloated AGENTS.md, CLAUDE.md, or similar agent instruction files to follow progressive disclosure principles. Splits monolithic files into organized, linked documentation.
中文简介正在准备中。当前显示原文说明。
Build and operate a live game using Unity Services. Use when the user needs to implement, connect, or debug backend-driven features — battle passes, achievements, player progression, cloud saves, leaderboards, matchmaking, virtual economies, server-authoritative logic, anti-cheat, player accounts and authentication, remote configuration, feature flags, A/B testing, analytics, or cloud resource deployment. Triggers on live-ops, live service, backend, server authority, cloud code, cloud save, remote config, player data, retention, monetization loop, season pass, ranking, multiplayer sessions, lobbies, or any Unity Services integration.
中文简介正在准备中。当前显示原文说明。
Kern engine critical invariants: coordinate system, UI Toolkit positioning, RenderTexture blit, LifetimeScope/scene structure, VolumeProfile editor API, camera pixel-grid alignment, performance analysis rules, profiler interpretation, and the no-fallback policy. Use when touching coordinates, WorldToScreen, UI element anchoring, RenderTexture, LifetimeScope, VolumeProfile, camera, FPS analysis, Profiler markers, or any code near an "invariant" comment. Triggers on: CoordinateUtils, MapManager.WorldHeight, RuntimePanelUtils, CameraTransformWorldToPanel, WorldToLocal, PositionWriteEpsilon, CameraPixelGridAligner, LifetimeScope, RegisterComponent, VolumeProfile, AssetDatabase.AddObjectToAsset, EditorLoop, VSync, fallback, paper white, FPS, frame time.
中文简介正在准备中。当前显示原文说明。
Kern project C# conventions, namespace rules, DI/VContainer patterns, and assembly layer boundaries. Use when writing, editing, or reviewing any C# file — MonoBehaviours, ScriptableObjects, services, contracts, factories, or editor scripts. Triggers on: namespace, nullable, asmdef, VContainer, RegisterComponent, IObjectResolver, composition root, Kern.Contracts, primary constructor, record struct, SA1513, _camelCase, PascalCase, asmref, MonoScript.GetClass.
中文简介正在准备中。当前显示原文说明。
Synchronize and compile FMOD Studio banks into StreamingAssets
中文简介正在准备中。当前显示原文说明。
Kern HDR/color pipeline contract: scene-referred linear working space, paper white units, radiance format rules, URP output transform ownership, DisplayFinal perceptual/linear space, UI brightness, HDR calibration screen, safe-start HDR switch, and HDROutputController usage. Use when touching lighting shaders, glow, bloom, tonemapping, post-processing, color grading, LUT, display output, UI colors, calibration, or any code with DisplaySettings / HDROutput / PaperWhite / Tonemapping / CompositeFinal / DisplayFinal / VisualTuning. Triggers on: saturate on radiance, clamp color, sRGB in shader, UNorm light buffer, ARGBHalf, paper white, HDROutputReconciler, VisualTuning, BT2390, detectPaperWhite, HDRCalibrationScreen, HDRSwitchPending, HDROutputSettings.
中文简介正在准备中。当前显示原文说明。