NOTE: This is now redundant with the introduction of UXF 2.0. This functionality is built-in to the UI system.
This is a Unity package that allows experiments built in UXF to upload their files to an Amazon Web Services S3 bucket.
Learn more about UXF here.
To use this in your project download the latest Release
Note: Requires Unity 2018 or newer.
- Add the latest UXF package to your project
- Add the latest AWS Mobile SDK for Unity to your project (S3 package is required, others are optional)
- Edit
s3_credentials.asset
with your credentials for AWS (or create new credentials: right click in the project panel -> create -> UXF_S3 -> Credentials). You can create/find your credentials in AWS Cognito. Find instructions in the AWS Mobile SDK for Unity documentation. - Add the
[UXF_S3_Uploader]
prefab to your scene. - Write your bucket name in the
S3Uploader
component. - In your
UXF.FileIOManager
component, add a new event toOnWriteFile
, reference yourS3Uploader
component and select theUpload
method. This means that files will be uploaded as soon a they are created. - If you have many files, your application could be quitting before they finish uploading. So the
S3UploadEnforcer
can be used to ensure files are finished before quitting. To do this make sure theUXF.Session.onSessionEnd
does not quit the application, and add theS3UploadEnforcer.EnforceThenInvokeEvent
method to the event. Now you can go to theS3UploadEnforcer
component of the prefab instance in your scene and set it to do whatever you want when all files have been safely uploaded (like quit the application).
Why does my editor keep crashing?
There seems to be a bug with the AWS SDK that means it can crash Unity if there are any errors in your credentials. Make sure your credentials are correct and try to safely exit play mode using the button in the S3UploadEnforcer
inspector.
How do I set up AWS permissions correctly?
- Make sure you have a Cognito identity pool set up with unauthorised access enabled (i.e. non logged in users)
- in IAM create a new policy on
Cognito_*UnauthRole
that has permissions to perform actionss3:PutObject
ands3:PutObjectTagging
on your bucket. - The resource for this policy should be
"Resource": "arn:aws:s3:::your-bucket-name/*"