S3Upload.md 2.8 KB

S3 resource upload

After completing 一键打包资源, open AppSettings and click 上传资源, then choose a folder. The folder picker starts in the latest complete AllRes directory matching the saved assembly, game scene, and current platform. Without such a directory, the upload button is disabled. DownloadUrl and S3 configuration are validated before opening the picker. The uploader sends the selected folder's contents recursively, preserving relative paths and empty folders. The selected folder's own name is not added to the destination.

The destination prefix is the final directory in the current DownloadUrl field. Both https://cdn.example.com/hexa_crazy/ and https://cdn.example.com/hexa_crazy/manifest_hot.json upload to s3://ios-games/hexa_crazy/. A nested URL ending in /games/hexa_crazy/ also uses only hexa_crazy/. A domain root without a directory is rejected.

This company-internal package stores S3 settings in Editor/Config/S3UploadSettings.json. Edit its Bucket, Region, AccessKey, SecretKey and optional SessionToken fields in the package source. The current destination is bucket ios-games, Region us-east-1. AppSettings no longer exposes a S3 configuration form, and uploads no longer read EditorPrefs or ~/.aws/credentials. The configuration ships with the internal package under Editor; it is not copied to Assets/Resources, StreamingAssets or Player assemblies.

Uploads use HTTPS directly to the regional S3 endpoint with AWS Signature Version 4 and signed payload hashes. No AWS CLI or SDK installation is required. The uploader streams files, shows progress, supports cancellation and retries temporary network/server failures. Files larger than 5 GiB and symbolic links are rejected during preflight. Existing objects with the same key are replaced; unrelated objects are not deleted. Bucket ACLs and CloudFront settings are not changed.

All resource files are uploaded before manifest.json and manifest_hot.json. A failed or canceled resource upload stops before publishing the manifests. Uploading an AllRes folder preserves both manifest names. After review, replace the remote manifest.json with manifest_hot.json, then refresh the S3/CDN cache to publish the update through the existing DownloadUrl. No manifests are renamed automatically. For explicit testing, DownloadUrl may also point directly at manifest_hot.json.

Manifests are uploaded with Cache-Control: no-cache, max-age=0, must-revalidate. CloudFront policies can override origin cache directives; this feature does not create CloudFront invalidations. Interrupted uploads can be restarted by selecting the same folder again.

References: AWS shared credentials, S3 Signature Version 4.