Skip to main content

export

Function export 

Source
pub fn export<'a>(
    obj: &ObjectRef,
    env: &Environment,
    extension: &'a str,
    meter: &Arc<Meter>,
) -> Result<Option<Export<'a>>, Error>
Expand description

Export an object. extension is the suffix already split from the destination, including its dot. TextAsset keeps it, defaulting an empty suffix to .txt; Font uses .otf/.ttf, MonoBehaviour .json/.bin. VideoClip keeps the supplied suffix, defaulting to .video.

MonoBehaviour encodes json.dumps(tree, indent=4, ensure_ascii=False) using UTF-8 surrogateescape, exactly as tools/extractor.py:215-223 does. A missing or unreadable tree, or a bytes value JSON cannot write, falls back to the object’s raw bytes; Export::fallback says why.