下载  >  移动开发  >  其它  > unity直接上传资源到oss

unity直接上传资源到oss 评分:

using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using Aliyun.OSS; using UnityEditor; using Aliyun.OSS.Common; public class AliyunOss { // 创建OssClient实例。 OssClient client; string endpoint = "https://oss-cn-shenzhen.aliyuncs.c

...展开详情
2018-11-21 上传 大小:204KB
举报 收藏
分享

评论 下载该资源后可以进行评论 共2条

zanglengyu 这个可以用,我用在untiy里边,不过好像异步上传用不了,unity里边只能用直接传输的,可能是和unity单线程有关系吧
2019-11-12
回复
shengruqing 就是一个dll不是脚本
2019-01-31
回复
using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using Aliyun.OSS; using UnityEditor; using Aliyun.OSS.Common; public class AliyunOss { // 创建OssClient实例。 OssClient client; string endpoint = "https://oss-cn-shenzhen.aliyuncs.com"; string accessKe yId = "LTAIEs3jNeemGrVB"; string accessKeySecret = "LCBXE73BHFkxwfOHVS7FOe0GBTaZVM"; string bucketName = "zhandingbo"; string objectName = "modal"; //string localFilename = "Assets/StreamingAssets"; //string outPath = "Assets/StreamingAssets"; //Application.temporaryCachePath string localFilename = "C:/Users/11854/Desktop/modal.png"; string outPath = "Assets/StreamingAssets"; //Application.temporaryCachePath #region 单例 private static AliyunOss mSelf = null; public static AliyunOss Instance { get { if (mSelf == null) { mSelf = new AliyunOss(); } return mSelf; } } AliyunOss() { client = new OssClient(endpoint, accessKeyId, accessKeySecret); } #endregion public void OssAb(string path, string name) { try { // 上传文件。 Debug.Log(path + "-----------" + objectName + path + "/" + name); // client.PutObject(bucketName, objectName + path + "/" + name, localFilename + path + "/" + name); // client.PutObject(bucketName, objectName , localFilename); client.PutObject(bucketName, path, name); Debug.Log("Oss succeeded"); } catch (Exception e) { Console.WriteLine(e); throw; } } }这个就是脚本