Skip to content

t1k:unity:mobile:core

FieldValue
Modulemobile
Version3.65.6
Effortmedium
Tools—

Keywords: Android, iOS, mobile, optimization

/t1k:unity:mobile:core

Unity Mobile — Optimization & Platform Patterns

Section titled “Unity Mobile — Optimization & Platform Patterns”

Mobile development reference for Unity 6. Covers Android, iOS, and cross-platform optimization.

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.

SettingPortrait baseline
Game-view aspect (validation)2160x1080 Portrait (Display 1) — the canonical aspect for this project
PlayerSettings.defaultIsFullScreentrue
PlayerSettings.allowedAutorotateToPortraittrue
PlayerSettings.allowedAutorotateToPortraitUpsideDownfalse (avoid front-camera/lens flips)
PlayerSettings.allowedAutorotateToLandscape*false for portrait-only titles
Camera projectionOrthographic for 2D / top-down; perspective with FOV ≥ 50° for 3D portrait — wide angles compensate for narrow horizontal frustum
Camera viewport ratio9: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.safeArea MUST 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.

Application.targetFrameRate = 30; // Battery-friendly
QualitySettings.vSyncCount = 0; // Required for targetFrameRate to work

Budgets consolidated. low-tier device targets: 100 draw calls / <100K tris / 200 MB (references/mobile-platform.md:14, adopted). The adopted mid tier instead comes from t1k-unity-editor-profiling/references/optimization-targets.md; this skill’s own mid-tier and texture-compression rows are preserved as budgets.json’s rejected tiersNotAdopted.mobilePlatformMid. The full tiered table and the per-asset import rules live in t1k:unity:optimize:assets (t1k-unity-optimize-assets/references/budgets.json).

  1. Shaders: Strip unused variants, use SimpleLit/Unlit, limit shadows (1 cascade, 1024px)
  2. Draw Calls: SRP Batcher + GPU Instancing + Texture Atlasing + Occlusion Culling
  3. Memory: Mipmaps on 3D textures, max 1024×1024 chars, stream music (>10s audio)
  4. Build Size: Managed Stripping = High, App Bundle (.aab) for Android, ARM64 only for iOS
  5. 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 .meta still reads textureCompression: 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 .meta files; the shipped encode is the fact.
  6. Platform overrides: platform overrides 0 means every target inherits the editor default. WebGL and iOS commonly have no m_BuildTargetDefaultTextureCompressionFormat entry at all.

→ See references/mobile-platform.md for full details on all categories, platform settings, gotchas.

  • Android: IL2CPP + ARM64, Vulkan (+ GLES3 fallback), API 24+, keystore for release
  • iOS: IL2CPP only, Metal only, iOS 15.0+, Xcode required
  • Both: Application.lowMemory handler; Screen.safeArea for 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.

  1. Editor vs Device: Always profile on target device
  2. Thermal throttling: Design for sustained perf (devices throttle after ~5 min)
  3. Background app: OnApplicationPause(true) — save state, pause timers
  4. Notch/cutout: Use Screen.safeArea for UI placement
  5. Managed Stripping = High is not a promise. A blanket preserve="all" in any link.xml reaching 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/ScriptAssemblies vs ManagedStripped) and report the outcome, not the level (t1k-unity-mobile-build-size/references/code-size-anatomy.md).
  6. With useCustomMainManifest: 1 the checked-in AndroidManifest.xml wins: a hardcoded android:versionCode="1" overrides the bundle-version bump and blocks a second upload to Play. Check it before any release build, and confirm AndroidTargetArchitectures matches the ABIs the build actually ships.
  • t1k-unity-editor-profiling — Device profiling and bottlenecks
  • t1k-unity-rendering-urp — Mobile rendering pipeline
  • t1k-unity-base-addressables — On-demand asset loading
  • t1k-unity-dots-core-performance — DOTS optimization (use t1k-unity-dots-core-optimizer agent)
  • 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.
FileContents
references/mobile-platform.mdFull tables, platform settings, memory, build size, gotchas
references/device-proof.mdPlay 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