关键是,我尝试按照firebase文档使用统一存储。专门用于上传图像文件。 https://firebase.google.com/docs/storage/unity/upload-files
这是我的代码
// Get a reference to the storage service, using the default Firebase App
Firebase.Storage.FirebaseStorage storage = Firebase.Storage.FirebaseStorage.DefaultInstance;
// Create a storage reference from our storage service
Firebase.Storage.StorageReference storage_ref = storage.GetReferenceFromUrl("gs://AR-Festival-2018.appspot.com");
// Data in memory
byte[] custom_bytes = SaveLoad.imageTexture[activeIndex].EncodeToPNG();
// Create a reference to the file you want to upload
Firebase.Storage.StorageReference rivers_ref = storage_ref.Child("images/rivers.jpg");
// Upload the file to the path "images/rivers.jpg"
rivers_ref.PutBytesAsync(custom_bytes)
.ContinueWith ((Task<StorageMetadata> task) => {
if (task.IsFaulted || task.IsCanceled) {
Debug.Log(task.Exception.ToString());
// Uh-oh, an error occurred!
} else {
// Metadata contains file metadata such as size, content-type, and download URL.
Firebase.Storage.StorageMetadata metadata = task.Result;
string download_url = metadata.DownloadUrl.ToString();
Debug.Log("Finished uploading...");
Debug.Log("download url = " + download_url);
}
});
简单地复制粘贴它会导致术语“任务”的结果。和&#39; StorageMetadata&#39;消息不存在: 名称&#39;任务&#39;在当前上下文中不存在
我错过了什么吗?我需要包含任何统一包以使任务工作吗? 我在c#
中使用了团结2017.3.1更新:
在Unity Log中,我收到此错误,
Assets / AR Part / Script / Gallery.cs(218,20):错误CS0246:类型或命名空间名称&#39;任务&#39;无法找到。你错过了`System.Threading.Tasks&#39;使用指令?