Home / Unity / U09

Unity error: *** Terminating app due to uncaught exception ‘(null)’, reason: ‘(null)’ / SpriteAtlasManager::RequestAtlasViaScript() (in TESTPROJECT) (SpriteAtlasManager.cpp:201) — cause and fix

On a real iOS device (iPhone10,3 / iOS 11.3, Unity 2017.1/2017.4/2018.1) loading an atlas

ID
U09
Engine
Unity
Verification
原文命中(抓取页面)
Frequency
论坛点赞=0

Original message (verbatim)

*** Terminating app due to uncaught exception ‘(null)’, reason: ‘(null)’ / SpriteAtlasManager::RequestAtlasViaScript() (in TESTPROJECT) (SpriteAtlasManager.cpp:201)

Placeholders such as %s / %d are kept verbatim from the engine source and are not replaced with concrete values.

Trigger

On a real iOS device (iPhone10,3 / iOS 11.3, Unity 2017.1/2017.4/2018.1) loading an atlas from an AssetBundle, when the atlasRequested callback fires with an empty or garbled tag string, RequestAtlasViaScript in the PlayerLoop dereferences the empty string causing SIGSEGV; crash breadcrumbs show consecutive empty-tag requests. Multi-line crash report.

Typical cause

The native layer passes the callback tag string to the managed layer (String::NewWrapper / ScriptingArguments::AddString); empty or invalid pointers are not null-checked, and strlen touches invalid memory and crashes; the callback code still looks up a Bundle by tag even when tag is empty.

Step-by-step fix

  1. At the start of the atlasRequested callback validate string.IsNullOrEmpty(tag); return directly on an empty tag without looking up a Bundle.
  2. Ensure atlas and sprite references are complete and bundle paths match tags.
  3. Reproduce in Editor and on device, and upgrade the engine version.
  4. Do not release the Bundle before the callback returns.

Source links

Per-entry sources and capture date are listed at /sources#U09.

Related errors

Related Unity errors

Need an offline quick-reference checklist?

Atlas error library Pro pack: 123 error references (110 single + 13 merged) plus a quick-fix guide, $19 one-time purchase, delivered as electronic files.

View Pro pack / order

Back to the all-errors index Checkout and buy the Pro pack — $19.00