UniTask/Assets/Scenes/SandboxMain.cs

27 lines
678 B
C#
Raw Permalink Normal View History

2019-05-30 18:41:23 +08:00
using System;
using System.Collections;
2019-05-19 23:14:47 +08:00
using System.Collections.Generic;
2020-04-15 14:23:23 +08:00
using System.IO;
2019-05-30 18:41:23 +08:00
using System.Threading;
2019-05-19 23:14:47 +08:00
using UniRx.Async;
using UnityEngine;
2019-05-30 18:41:23 +08:00
using UnityEngine.Networking;
using UnityEngine.UI;
2019-05-19 23:14:47 +08:00
public class SandboxMain : MonoBehaviour
{
2019-05-30 18:41:23 +08:00
public Button okButton;
public Button cancelButton;
CancellationTokenSource cts;
2019-05-19 23:14:47 +08:00
2019-05-30 18:41:23 +08:00
async void Start()
2019-05-19 23:14:47 +08:00
{
2020-04-15 14:23:23 +08:00
UnityEngine.Debug.Log("DOWNLOAD START:" + Time.frameCount);
2019-05-30 18:41:23 +08:00
2020-04-15 14:23:23 +08:00
var req = await UnityWebRequest.Get(Path.Combine(Application.streamingAssetsPath, "test.txt")).SendWebRequest();
UnityEngine.Debug.Log("DOWNLOAD RESULT:" + Time.frameCount + ", " + req.downloadHandler.text);
2019-05-19 23:14:47 +08:00
}
}
2019-05-30 18:41:23 +08:00