Logo Unity Platforms

Unity Platforms

Tổ chức
Nice-Wolf-Studio
unity-platforms

Unity 6 platform targeting and build guide. Use when building for specific platforms, configuring build profiles, using platform scripting defines (#if UNITY_IOS, #if UNITY_ANDROID), optimizing for mobile, WebGL, or consoles, working with Addressables/asset bundles, or choosing between IL2CPP and Mono. Based on Unity 6.3 LTS documentation.

Tổng quan

Nhà phát hànhNice-Wolf-Studio
Kho mãunity-claude-skills
Tên kỹ năngunity-platforms
Sao
40
Bản fork
5
Tệp đi kèm
2
Giấy phépMIT
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 là Markdown thuần túy, không phải 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ộ.

  • 2 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 Nice-Wolf-Studio công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Unity Platforms 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 thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/Nice-Wolf-Studio/unity-claude-skills/tree/main/skills/unity-platforms
  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/Nice-Wolf-Studio/unity-claude-skills.git /tmp/unity-claude-skills
mkdir -p .claude/skills
cp -r /tmp/unity-claude-skills/skills/unity-platforms .claude/skills/unity-platforms
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 Unity Platforms 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ự tải Unity Platforms 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 Unity Platforms không bị giới hạn ở mô hình mà kỹ năng này được viết cho. 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 kỹ năng chưa dùng không tốn chi phí.

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

Unity Platforms Skill

Supported Platforms

Unity 6 supports the following platform categories:

  • Desktop: Windows, macOS, Linux
  • Mobile: Android, iOS
  • Emerging: visionOS, tvOS
  • Web: WebGL (including Facebook Instant Games)
  • Server: Dedicated Server
  • Embedded: Embedded Linux, QNX
  • UWP: Universal Windows Platform
  • Closed Platforms: PlayStation, Xbox (Game Core), Nintendo (require confidentiality/legal agreements and registration via Platform Module Installation)

Build Profiles and Settings

Build Profiles replace the old Build Settings window. A build profile is a set of configuration settings for building your application on a particular platform.

Two Profile Types

  1. Platforms: Display currently installed platforms with shared settings across all configurations. Enabling options like Development Build applies universally. Platforms share identical scene data across profiles.
  2. Build Profiles: Independent configurations not shared across platforms. Each can specify unique scenes and settings. Stored as asset files compatible with version control.

Key Features

  • Custom naming for organizing multiple build configurations
  • Version control integration (profiles stored as asset files)
  • Per-profile scene assignment
  • Development builds (debug symbols, Profiler access) and release builds
  • Access via File > Build Profiles
  • Duplicate a platform via right-click > "Copy to new profile"

Scene Management

Scenes are managed per-profile. You can add, exclude, remove, and reorder scenes in your build. Each unique Scene file represents a unique level or screen.

Platform Scripting Defines

Use #if directives to conditionally compile code per platform.

Platform Defines

DefinePlatform
UNITY_EDITORAny Editor code
UNITY_EDITOR_WINWindows Editor
UNITY_EDITOR_OSXmacOS Editor
UNITY_EDITOR_LINUXLinux Editor
UNITY_STANDALONE_OSXmacOS Standalone
UNITY_STANDALONE_WINWindows Standalone
UNITY_STANDALONE_LINUXLinux Standalone
UNITY_STANDALONEAny Standalone (Win/Mac/Linux)
UNITY_SERVERDedicated Server
UNITY_IOSiOS
UNITY_ANDROIDAndroid
UNITY_TVOStvOS
UNITY_VISIONOSvisionOS
UNITY_WEBGLWebGL
UNITY_WSAUniversal Windows Platform
UNITY_WSA_10_0UWP 10.0
UNITY_EMBEDDED_LINUXEmbedded Linux
UNITY_QNXQNX
UNITY_FACEBOOK_INSTANT_GAMESFacebook Instant Games

Feature and Backend Defines

DefineMeaning
UNITY_ANALYTICSAnalytics enabled
UNITY_ASSERTIONSAssertions enabled
UNITY_6464-bit platform
ENABLE_MONOMono scripting backend
ENABLE_IL2CPPIL2CPP scripting backend
ENABLE_VRVR support enabled
ENABLE_INPUT_SYSTEMNew Input System enabled
ENABLE_LEGACY_INPUT_MANAGERLegacy Input Manager enabled
ENABLE_WINMD_SUPPORTWinMD support
DEVELOPMENT_BUILDDevelopment build
UNITY_CLOUD_BUILDCloud Build

.NET API Level Defines

DefineAPI Level
NET_STANDARD_2_0.NET Standard 2.0
NET_STANDARD_2_1.NET Standard 2.1
NET_STANDARD / NETSTANDARDAny .NET Standard
NETSTANDARD2_1.NET Standard 2.1 (C# define)
NET_4_6.NET Framework
NET_2_0 / NET_LEGACY.NET 2.0 (legacy)
CSHARP_7_3_OR_NEWERC# 7.3+ available

Version Defines

Format: UNITY_X, UNITY_X_Y, UNITY_X_Y_Z, UNITY_X_Y_OR_NEWER

Example for Unity 6000.0.33:

  • UNITY_6000, UNITY_6000_0, UNITY_6000_0_33, UNITY_6000_0_OR_NEWER

Mobile Optimization

iOS

Architecture: ARM64 only (no ARMv7).

Scripting Backend: IL2CPP required for iOS (no Mono option).

Player Settings (Edit > Project Settings > Player > iOS):

  • Bundle Identifier: com.CompanyName.ProductName
  • Signing Team ID + Automatic Sign for Xcode
  • Target minimum iOS version selectable
  • Metal API Validation for debug shader issues
  • Metal Write-Only Backbuffer for performance in non-default orientations
  • Force hard shadows on Metal (point sampling for performance)
  • Orientation: Portrait, Landscape, or Auto Rotation with allowed orientations
  • Launch Screen: Default, Image, or Custom Storyboard
  • Requires ARKit support restricts to iPhone 6s/iOS 11+

Android

Architectures: ARMv7 and ARM64 (ARM64 requires IL2CPP).

Player Settings (Edit > Project Settings > Player > Android):

  • Package Name: com.YourCompanyName.YourProductName
  • Minimum API Level and Target API Level
  • Graphics API: Auto (Vulkan first, GLES fallback), Vulkan, or OpenGL ES 3.x
  • Split APKs by target architecture for smaller downloads on Google Play
  • Keystore configuration for signing (custom keystore for production)
  • Scripting Backend: Mono or IL2CPP
  • API Compatibility: .NET Framework or .NET Standard 2.1
  • Managed Stripping Level: Minimal to High

Key Difference: Android hardware capabilities vary significantly between models. Test across multiple devices.

Mobile Optimization Tips

  • Use ASTC texture compression (supported on both iOS and Android modern devices)
  • Minimize draw calls via batching (static and dynamic)
  • Use AssetBundles or Addressables for on-demand content
  • Profile with Unity Profiler and platform-specific tools
  • Reduce shader complexity on mobile GPUs

WebGL Considerations

Memory Management

  • Unity heap implemented as WebAssembly Memory (resizable ArrayBuffer)
  • Heap can expand up to 4 GB (Maximum Memory Size in Player Settings)
  • Asset data unpacked from .data file into virtual memory file system (Emscripten)
  • Garbage collector only runs at end of each frame (no mid-frame collection)
  • Available memory depends on device, OS, browser (32/64-bit), and tab isolation model

Memory Optimization

Use StringBuilder instead of string concatenation in loops:

csharp
// BAD: Creates ~15 GB temporary allocations for 100k iterations
string hugeString = "";
for (int i = 0; i < 100000; i++)
    hugeString += "foo";

// GOOD: Pre-allocated StringBuilder
var sb = new StringBuilder();
for (int i = 0; i < 10000; i++)
    sb.Append("foo");

Use NativeArray<T> for temporary allocations to bypass GC:

csharp
using (var data = new NativeArray<byte>(size, Allocator.Temp))
{
    // Memory freed immediately upon scope exit
}

Use AssetBundles for asset loading (downloads directly into Unity heap without extra browser allocation).

Enable Data Caching (IndexedDB/Caching APIs) to reduce re-downloads.

JavaScript Interop

Unity supports two JavaScript plug-in file types:

  • .jslib: Define functions callable from C# code
  • .jspre: Include existing JavaScript libraries

Limitation: Only ECMAScript 5 (ES5) syntax supported in .jslib and .jspre files. ES6 is not yet supported.

.jslib Plugin Example
javascript
// Assets/Plugins/WebGL/MyPlugin.jslib
mergeInto(LibraryManager.library, {
    ShowAlert: function (message) {
        window.alert(UTF8ToString(message));
    },
});
C# Calling JavaScript
csharp
using System.Runtime.InteropServices;
using UnityEngine;

public class WebGLBridge : MonoBehaviour
{
    [DllImport("__Internal")]
    private static extern void ShowAlert(string message);

    void Start()
    {
        #if UNITY_WEBGL && !UNITY_EDITOR
        ShowAlert("Hello from Unity!");
        #endif
    }
}

IL2CPP vs Mono

IL2CPP (Intermediate Language To C++)

IL2CPP is Unity's custom AOT scripting backend that converts C# to native code via C++.

Conversion Pipeline:

  1. Roslyn compiler converts C# to .NET managed assemblies (DLLs)
  2. Managed code stripping reduces application size
  3. All managed assemblies convert to standard C++ code
  4. C++ compiler generates platform-specific machine code
  5. Creates executables, DLLs, APK/AAB, or app bundles

Advantages:

  • Improved runtime performance over Mono
  • Shorter application startup times
  • Supported across all platforms
  • Supports managed code debugging identically to Mono

Disadvantages:

  • Significantly longer build times than Mono
  • Increased final application size
  • Cross-compilation generally unsupported (must build on target OS)
  • Exception: Linux cross-compilation supported from any desktop platform

Configuration:

  • Player Settings: Edit > Project Settings > Player > Configuration > Scripting Backend
  • Scripting API: PlayerSettings.SetScriptingBackend

Build Speed Optimization:

  • Exclude project folders from antimalware scans
  • Use fastest available storage drives
  • Select "Optimize for code size and build time" (trades runtime performance)
  • Use Burst compiler alongside IL2CPP for compatible code

Mono

  • Faster build times (JIT compilation)
  • Smaller build output
  • Not available on all platforms (iOS requires IL2CPP)
  • Less runtime performance than IL2CPP

When to Choose

CriteriaIL2CPPMono
iOS buildsRequiredNot available
Android buildsRecommended for ARM64Available for ARMv7
Build iteration speedSlowerFaster
Runtime performanceBetterGood
Console platformsRequiredNot available
WebGLRequiredNot available

Addressables Overview

The Addressable Asset System (com.unity.addressables v2.9.1) enables referencing assets by address rather than direct paths.

Key Concepts

  • Mark any asset as "addressable" to generate a unique address callable from anywhere
  • Supports loading from local or remote locations
  • Uses asynchronous loading with automatic dependency resolution
  • Replaces direct references, traditional asset bundles, and Resources folders
  • Access via: Window > Asset Management > Addressables

Basic Usage Pattern

csharp
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

public class AddressableLoader : MonoBehaviour
{
    [SerializeField] private AssetReference prefabRef;

    async void Start()
    {
        AsyncOperationHandle<GameObject> handle =
            Addressables.InstantiateAsync(prefabRef);
        await handle.Task;

        if (handle.Status == AsyncOperationStatus.Succeeded)
        {
            Debug.Log("Asset loaded successfully");
        }
    }

    void OnDestroy()
    {
        // Always release when done
        prefabRef.ReleaseAsset();
    }
}

Common Patterns

Platform-Specific Code

csharp
public class PlatformManager : MonoBehaviour
{
    void Start()
    {
        #if UNITY_IOS
        Application.targetFrameRate = 60;
        #elif UNITY_ANDROID
        Application.targetFrameRate = 60;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        #elif UNITY_WEBGL
        // WebGL runs at browser refresh rate
        #elif UNITY_STANDALONE
        Application.targetFrameRate = -1; // Uncapped
        #endif
    }
}

Runtime Platform Check

csharp
void ConfigureForPlatform()
{
    switch (Application.platform)
    {
        case RuntimePlatform.IPhonePlayer:
            SetupMobileControls();
            break;
        case RuntimePlatform.Android:
            SetupMobileControls();
            break;
        case RuntimePlatform.WebGLPlayer:
            SetupWebControls();
            break;
        default:
            SetupDesktopControls();
            break;
    }
}

Build Profile Scripting

csharp
#if DEVELOPMENT_BUILD
    Debug.Log("Development build active");
#endif

#if ENABLE_IL2CPP
    // IL2CPP-specific code
#elif ENABLE_MONO
    // Mono-specific code
#endif

Anti-Patterns

  1. Using Resources folder for everything instead of Addressables. Resources folder loads all assets at startup, increasing memory usage and load times.

  2. Not using platform defines and relying solely on runtime checks. Compile-time defines exclude unused code from builds entirely.

  3. String concatenation in WebGL loops. GC only runs at frame end in WebGL, causing massive temporary allocations. Use StringBuilder or NativeArray<T>.

  4. Ignoring IL2CPP AOT restrictions. Reflection-heavy code, System.Reflection.Emit, and runtime code generation will fail under IL2CPP. Design with AOT in mind.

  5. Shipping with Development Build enabled. Development builds include Profiler overhead and debug symbols, increasing size and reducing performance.

  6. Not splitting APKs by architecture on Android. Shipping a single fat APK with both ARMv7 and ARM64 wastes user bandwidth. Use Split APKs or App Bundles.

  7. Hardcoding platform paths. Use Application.persistentDataPath, Application.streamingAssetsPath, and Application.temporaryCachePath for cross-platform file access.

  8. Not testing on actual devices. Android hardware varies enormously. Emulators and simulators do not represent real performance characteristics.

Key API Quick Reference

APIPurpose
Application.platformRuntime platform detection
RuntimePlatform enumPlatform constants for runtime checks
SystemInfo.graphicsDeviceTypeCurrent graphics API (Vulkan, Metal, etc.)
SystemInfo.supportsComputeShadersCheck compute shader support
PlayerSettings.SetScriptingBackend()Set IL2CPP or Mono via script
Addressables.InstantiateAsync()Load and instantiate addressable asset
Addressables.LoadAssetAsync<T>()Load addressable asset without instantiation
AssetReferenceSerializable reference to an addressable asset
Application.targetFrameRateSet target frame rate
Screen.sleepTimeoutPrevent screen dimming on mobile
Application.persistentDataPathPlatform-safe writable data path

Related Skills

  • unity-graphics — Rendering pipelines, shaders, and visual effects
  • unity-packages-services — Package Manager workflow and Unity Gaming Services

Additional Resources

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

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

Kỹ năng AI Unity Platforms làm được gì?

Unity 6 platform targeting and build guide. Use when building for specific platforms, configuring build profiles, using platform scripting defines (#if UNITY_IOS, #if UNITY_ANDROID), optimizing for mobile, WebGL, or consoles, working with Addressables/asset bundles, or choosing between IL2CPP and Mono. Based on Unity 6.3 LTS documentation.

Vì sao nên dùng Unity Platforms 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. Unity Platforms 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 Unity Platforms trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Nice-Wolf-Studio/unity-claude-skills/tree/main/skills/unity-platforms. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành 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 Unity Platforms?

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.

Bạn có thể dùng Unity Platforms 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 Unity Platforms 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 Unity Platforms có miễn phí không?

Có. Kỹ năng này được Nice-Wolf-Studio phát hành trên GitHub theo giấy phép MIT. 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 cho mô hình các công cụ mới để gọi — mã đượ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à tiêu chí của đầu ra tốt. 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 👇