Class AddressableException
The exception thrown when an Addressables operation fails within the Scylla Addressables utility layer. Extends Exception with a structured ErrorCode and an optional Address so that callers can distinguish failure modes (e.g., asset not found vs. network error vs. cancelled) and identify which asset key triggered the failure.
Implements
Inherited Members
Namespace: Scylla.Core.Util.Addressables
Assembly: ScyllaCore.dll
Syntax
public class AddressableException : Exception, ISerializable
Remarks
AddressableException is the exclusive exception type thrown by
ScyllaAddressables. All Unity AsyncOperationHandle failures
and other unexpected exceptions are wrapped into this type by
AddressableUtil.WrapException, preserving the original exception as
InnerException.
When working with the result-pattern API (methods that return
AddressableResult or AddressableResult<T>), you will
typically not need to catch this exception directly - use
IsSuccess and
ErrorCode instead. The exception-throwing API
surface is the async/await overloads and handle-returning overloads in
ScyllaAddressables.
If ErrorCode is NotInitialized,
the Addressables package is not installed or the SCYLLA_HAS_ADDRESSABLES
define is absent. All methods in ScyllaAddressables throw this error in
non-Addressables builds.
Constructors
AddressableException(AddressableErrorCode)
Initializes a new instance of the AddressableException class with the specified error code. The exception message is derived automatically from the error code via an internal default-message lookup. Use this constructor when you want a consistent, code-driven message without supplying custom text.
Declaration
public AddressableException(AddressableErrorCode errorCode)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableErrorCode | errorCode | The AddressableErrorCode value that categorizes the failure. |
AddressableException(AddressableErrorCode, string)
Initializes a new instance of the AddressableException class with the specified error code and a custom human-readable message. Use this constructor when the default message for the error code is insufficient and you want to provide context-specific details.
Declaration
public AddressableException(AddressableErrorCode errorCode, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableErrorCode | errorCode | The AddressableErrorCode value that categorizes the failure. |
| string | message | A human-readable description of the failure. This becomes Message. |
AddressableException(AddressableErrorCode, string, Exception)
Initializes a new instance of the AddressableException class with
the specified error code, custom message, and an inner exception. Use this
constructor when wrapping a lower-level exception (such as a Unity
AsyncOperationHandle failure or an OperationCanceledException) so
that the original cause is preserved in InnerException.
Declaration
public AddressableException(AddressableErrorCode errorCode, string message, Exception innerException)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableErrorCode | errorCode | The AddressableErrorCode value that categorizes the failure. |
| string | message | A human-readable description of the failure. This becomes Message. |
| Exception | innerException | The exception that originally caused this failure, available via
InnerException. May be |
AddressableException(AddressableErrorCode, string, string)
Initializes a new instance of the AddressableException class with the specified error code, custom message, and the Addressables address that caused the failure. Use this constructor when the failure is tied to a specific asset key so that the address can be inspected via Address.
Declaration
public AddressableException(AddressableErrorCode errorCode, string message, string address)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableErrorCode | errorCode | The AddressableErrorCode value that categorizes the failure. |
| string | message | A human-readable description of the failure. This becomes Message. |
| string | address | The Addressables address (asset key) that was being accessed when the error
occurred. May be |
AddressableException(AddressableErrorCode, string, string, Exception)
Initializes a new instance of the AddressableException class with
the full set of diagnostic properties: error code, message, address, and inner
exception. This is the most information-rich constructor and is used internally by
AddressableUtil.WrapException and AddressableUtil.CreateFromHandle
when all context is available.
Declaration
public AddressableException(AddressableErrorCode errorCode, string message, string address, Exception innerException)
Parameters
| Type | Name | Description |
|---|---|---|
| AddressableErrorCode | errorCode | The AddressableErrorCode value that categorizes the failure. |
| string | message | A human-readable description of the failure. This becomes Message. |
| string | address | The Addressables address (asset key) that was being accessed when the error
occurred. May be |
| Exception | innerException | The exception that originally caused this failure, available via
InnerException. May be |
Properties
Address
Gets the Addressables address (asset key) that was being accessed when the error
occurred, or null if the failure is not tied to a specific address (for
example, a catalog update failure or an invalid-settings error).
Declaration
public string Address { get; }
Property Value
| Type | Description |
|---|---|
| string | A non-empty address string when the failure is address-specific (e.g.,
AssetNotFound or
LoadFailed); otherwise |
ErrorCode
Gets the structured error code that categorizes the type of Addressables failure. Use this to implement targeted error handling without parsing the exception message.
Declaration
public AddressableErrorCode ErrorCode { get; }
Property Value
| Type | Description |
|---|---|
| AddressableErrorCode | One of the AddressableErrorCode values. For exceptions constructed without an explicit error code this defaults to Unknown. |