t1k:unity:mobile:core
| Field | Value |
|---|---|
| Module | mobile |
| Version | 3.65.6 |
| Effort | medium |
| Tools | — |
Keywords: Android, iOS, mobile, optimization
How to invoke
Section titled “How to invoke”/t1k:unity:mobile:coreUnity Mobile — Optimization & Platform Patterns
Section titled “Unity Mobile — Optimization & Platform Patterns”Mobile development reference for Unity 6. Covers Android, iOS, and cross-platform optimization.
Form Factor: Portrait-First by Default
Section titled “Form Factor: Portrait-First by Default”Default assumption: portrait orientation. Most mobile games and casual genres ship portrait-only. Tune every demo, scene, and HUD against portrait first; landscape is a follow-up validation, not the baseline.
| Setting | Portrait baseline |
|---|---|
| Game-view aspect (validation) | 2160x1080 Portrait (Display 1) — the canonical aspect for this project |
PlayerSettings.defaultIsFullScreen | true |
PlayerSettings.allowedAutorotateToPortrait | true |
PlayerSettings.allowedAutorotateToPortraitUpsideDown | false (avoid front-camera/lens flips) |
PlayerSettings.allowedAutorotateToLandscape* | false for portrait-only titles |
| Camera projection | Orthographic for 2D / top-down; perspective with FOV ≥ 50° for 3D portrait — wide angles compensate for narrow horizontal frustum |
| Camera viewport ratio | 9:16 (or 9:19.5 / 9:20 for modern phones) — design HUD around the centered safe band |
HUD layout discipline (portrait):
- Thumb reach: bottom ~30% of the screen is the primary action zone. Place primary CTAs there.
- Top ~15% is the status band (coins/energy/timer); keep it readable when notches/cutouts intrude.
Screen.safeAreaMUST gate every Canvas anchored to the screen edge — Dynamic Island, notch, and home-indicator slabs change the usable rect.- Test text legibility at 9:19.5 and 9:20 (Pixel 7, Galaxy S23) — they crop tighter than 9:16 references.
Validation rule (matches project CLAUDE.md): When entering Play mode for any demo, the Game-view aspect MUST be 2160x1080 Portrait. A landscape Game-view at runtime is a setup bug — fix the Game-view aspect, not the demo.
Frame Rate & Battery
Section titled “Frame Rate & Battery”Application.targetFrameRate = 30; // Battery-friendlyQualitySettings.vSyncCount = 0; // Required for targetFrameRate to workBudgets consolidated.
low-tier device targets: 100 draw calls / <100K tris / 200 MB (references/mobile-platform.md:14, adopted). The adoptedmidtier instead comes fromt1k-unity-editor-profiling/references/optimization-targets.md; this skill’s own mid-tier and texture-compression rows are preserved asbudgets.json’s rejectedtiersNotAdopted.mobilePlatformMid. The full tiered table and the per-asset import rules live int1k:unity:optimize:assets(t1k-unity-optimize-assets/references/budgets.json).
Key Optimization Areas
Section titled “Key Optimization Areas”- Shaders: Strip unused variants, use SimpleLit/Unlit, limit shadows (1 cascade, 1024px)
- Draw Calls: SRP Batcher + GPU Instancing + Texture Atlasing + Occlusion Culling
- Memory: Mipmaps on 3D textures, max 1024×1024 chars, stream music (>10s audio)
- Build Size: Managed Stripping = High, App Bundle (.aab) for Android, ARM64 only for iOS
- Texture format actually applied: a texture whose width or height is not divisible by 4
silently ships RGBA32/RGB24 — block compression (DXT/ETC2, and ASTC’s 4×4 block) cannot encode
a partial block, and the importer falls back instead of resizing or warning. The
.metastill readstextureCompression: Normal, so an import audit sees nothing wrong. Measured on one WebGL player: 1,303 of 1,303 non-4-divisible textures uncompressed (327 MB of a 369 MB payload). Fix by re-exporting at 4-divisible dimensions or with an import postprocessor. Verify with a content census (t1k-unity-mobile-build-size/references/artifact-census.md), not by reading.metafiles; the shipped encode is the fact. - Platform overrides:
platform overrides 0means every target inherits the editor default. WebGL and iOS commonly have nom_BuildTargetDefaultTextureCompressionFormatentry at all.
→ See references/mobile-platform.md for full details on all categories, platform settings, gotchas.
Platform Quick Reference
Section titled “Platform Quick Reference”- Android: IL2CPP + ARM64, Vulkan (+ GLES3 fallback), API 24+, keystore for release
- iOS: IL2CPP only, Metal only, iOS 15.0+, Xcode required
- Both:
Application.lowMemoryhandler;Screen.safeAreafor notch/cutout UI
Before a build reaches a human, play it: install it, drive every state, read the frames and count the runtime log,
then verify the artifact (badging, signature, archive test, .sha256). Recipe: references/device-proof.md.
Hard rules
Section titled “Hard rules”- Editor vs Device: Always profile on target device
- Thermal throttling: Design for sustained perf (devices throttle after ~5 min)
- Background app:
OnApplicationPause(true)— save state, pause timers - Notch/cutout: Use
Screen.safeAreafor UI placement - Managed Stripping = High is not a promise. A blanket
preserve="all"in anylink.xmlreaching the linker overrides it for that assembly; measured 511 entries covering 64% of assemblies produced a 15.2% strip rate overall. The setting is also per build target and its applied value is not recorded on disk after a build — measure pre-link vs post-link (Library/ScriptAssembliesvsManagedStripped) and report the outcome, not the level (t1k-unity-mobile-build-size/references/code-size-anatomy.md). - With
useCustomMainManifest: 1the checked-inAndroidManifest.xmlwins: a hardcodedandroid:versionCode="1"overrides the bundle-version bump and blocks a second upload to Play. Check it before any release build, and confirmAndroidTargetArchitecturesmatches the ABIs the build actually ships.
Related Skills & Agents
Section titled “Related Skills & Agents”t1k-unity-editor-profiling— Device profiling and bottleneckst1k-unity-rendering-urp— Mobile rendering pipelinet1k-unity-base-addressables— On-demand asset loadingt1k-unity-dots-core-performance— DOTS optimization (uset1k-unity-dots-core-optimizeragent)t1k-unity-mobile-build-size— measuring and cutting a built APK/AAB/WebGL artifact:apk_breakdown.py,import_audit.py, import budgets, boot/GC shapes. Use it whenever the question is “why is the build this big / this slow to boot” — this skill keeps the platform settings, that one does the artifact audit.
Reference Files
Section titled “Reference Files”| File | Contents |
|---|---|
references/mobile-platform.md | Full tables, platform settings, memory, build size, gotchas |
references/device-proof.md | Play a build before a human is asked to: emulator playthrough, frames per state, logcat counts, and the artifact checks (badging, signature, archive, .sha256) on the APK you hand over |