docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class UriValue

    Holds the value of a glTF URI field. For a regular URI (relative path or remote URL) the original string is preserved. For a base-64 data: URI the payload is decoded into a NativeArray_1 during JSON parsing, avoiding the otherwise required UTF-16 string allocation of the (potentially very large) encoded payload.

    Inheritance
    object
    UriValue
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.Cloud.Gltfast.Objects
    Assembly: Unity.Cloud.Gltfast.dll
    Syntax
    [JsonConverter(typeof(UriValueConverter))]
    public sealed class UriValue : IDisposable
    Remarks

    Instances that own decoded data must be disposed. Buffer, Image and Root forward Dispose() calls automatically.

    Constructors

    UriValue(string)

    Creates a wrapper for a regular URI string (relative path or remote URL).

    Declaration
    public UriValue(string uri)
    Parameters
    Type Name Description
    string uri

    URI value.

    Properties

    IsData

    True if this URI wraps successfully decoded data URI bytes that have not yet been taken over by the loader.

    Declaration
    public bool IsData { get; }
    Property Value
    Type Description
    bool

    IsFailed

    True if the URI was recognized as a data URI but decoding the payload failed.

    Declaration
    public bool IsFailed { get; }
    Property Value
    Type Description
    bool

    IsString

    True if this URI is a regular string (not an inlined data URI).

    Declaration
    public bool IsString { get; }
    Property Value
    Type Description
    bool

    MimeType

    MIME type extracted from a data URI's media type segment. Returns null for non-data URIs and for failed decodes.

    Declaration
    public string MimeType { get; }
    Property Value
    Type Description
    string

    Methods

    AsString()

    Returns the URI string for non-data URIs.

    Declaration
    public string AsString()
    Returns
    Type Description
    string

    URI string for non-data URIs

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when this wrapper does not hold a string (i.e. data, transferred or failed state). There is no implicit fallback to base-64-encode the data: callers requiring a string representation for a data URI must reconstruct it themselves.

    Dispose()

    Disposes the decoded data URI payload, if owned. Idempotent: safe to call multiple times and in any state.

    Declaration
    public void Dispose()

    TryGetData(out NativeArray<byte>)

    Returns the decoded data URI payload as a non-owning view. The wrapper retains ownership of the underlying NativeArray_1; callers must not dispose the returned array. Safe to call any number of times.

    Declaration
    public bool TryGetData(out NativeArray<byte> data)
    Parameters
    Type Name Description
    NativeArray<byte> data

    Receives the decoded bytes on success.

    Returns
    Type Description
    bool

    True if decoded data is available, false otherwise.

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)