EllanJiang/GameFramework · error · GameFrameworkException
You can not use VerifyResources without updatable resource…
Error message
You can not use VerifyResources without updatable resource mode.
What it means
Thrown by ResourceManager.VerifyResources when the resource mode is neither Updatable nor UpdatableWhilePlaying. Verification (checking local resource integrity against a remote version list) only applies to updatable modes; in package modes there is nothing to verify.
Solutions
- Switch to ResourceMode.Updatable or UpdatableWhilePlaying before calling VerifyResources.
- Gate the VerifyResources call behind a check: if (mode is Updatable or UpdatableWhilePlaying).
- Remove VerifyResources calls from package-mode build variants.
Example fix
// before
m_ResourceManager.VerifyResources(1024 * 1024, OnComplete);
// after
if (m_ResourceMode == ResourceMode.Updatable || m_ResourceMode == ResourceMode.UpdatableWhilePlaying) {
m_ResourceManager.VerifyResources(1024 * 1024, OnComplete);
} Defensive patterns
Strategy: validation
Validate before calling
if (m_ResourceManager.ResourceMode == ResourceMode.Unspecified) {
throw new InvalidOperationException("Set resource mode before VerifyResources");
}
m_ResourceManager.VerifyResources(len, cb); Type guard
bool IsResourceModeReady(ResourceMode mode) => mode != ResourceMode.Unspecified;
Try / catch
try { m_ResourceManager.VerifyResources(len, cb); } catch (GameFrameworkException ex) { Log.Error(ex.Message); } Prevention
- Call VerifyResources only from the resource component's initialization-complete callback.
- Configure ResourceMode in the inspector or bootstrap before any update logic.
- Centralize the update flow in one state machine.
When it happens
Trigger: Calling VerifyResources while m_ResourceMode is Package (or another non-updatable mode), e.g. after switching build mode to Package for a store build and leaving old VerifyResources calls in code.
Common situations: Shipping builds configured with ResourceMode.Package but test code still triggering verification; config mismatch between editor and device builds; QA toggles changing resource mode at runtime.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- You can not use CheckResources without updatable resource…
- You must set resource mode first.
- You can not use InitResources without package resource mode.
- You can not use CheckVersionList without updatable resource…
- You can not use UpdateVersionList without updatable…
AI-assisted analysis of EllanJiang/GameFramework@d0c010b051 (2026-09-15).
Data as JSON: /api/errors/49f5d0d6794928cf.
Report an issue: GitHub.
Appendix: source
Thrown at GameFramework/Resource/ResourceManager.cs:1193
/// 使用可更新模式并校验资源。
/// </summary>
/// <param name="verifyResourceLengthPerFrame">每帧至少校验资源的大小,以字节为单位。</param>
/// <param name="verifyResourcesCompleteCallback">使用可更新模式并校验资源完成时的回调函数。</param>
public void VerifyResources(int verifyResourceLengthPerFrame, VerifyResourcesCompleteCallback verifyResourcesCompleteCallback)
{
if (verifyResourcesCompleteCallback == null)
{
throw new GameFrameworkException("Verify resources complete callback is invalid.");
}
if (m_ResourceMode == ResourceMode.Unspecified)
{
throw new GameFrameworkException("You must set resource mode first.");
}
if (m_ResourceMode != ResourceMode.Updatable && m_ResourceMode != ResourceMode.UpdatableWhilePlaying)
{
throw new GameFrameworkException("You can not use VerifyResources without updatable resource mode.");
}
if (m_RefuseSetFlag)
{
throw new GameFrameworkException("You can not verify resources at this time.");
}
m_ResourceVerifier = new ResourceVerifier(this);
m_ResourceVerifier.ResourceVerifyStart += OnVerifierResourceVerifyStart;
m_ResourceVerifier.ResourceVerifySuccess += OnVerifierResourceVerifySuccess;
m_ResourceVerifier.ResourceVerifyFailure += OnVerifierResourceVerifyFailure;
m_ResourceVerifier.ResourceVerifyComplete += OnVerifierResourceVerifyComplete;
m_VerifyResourcesCompleteCallback = verifyResourcesCompleteCallback;
m_ResourceVerifier.VerifyResources(verifyResourceLengthPerFrame);
}
/// <summary>
/// 使用可更新模式并检查资源。View on GitHub (pinned to d0c010b051)