回答編集履歴
3
コードを修正
answer
CHANGED
@@ -7,16 +7,18 @@
|
|
7
7
|
{
|
8
8
|
using (UnityWebRequest request = new UnityWebRequest(url))
|
9
9
|
{
|
10
|
-
|
10
|
+
request.method = UnityWebRequest.kHttpVerbGET;
|
11
11
|
request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
|
12
12
|
|
13
13
|
yield return request.Send();
|
14
14
|
|
15
|
+
if((int)request.responseCode < 299
|
15
|
-
|
16
|
+
&& (int)request.responseCode == 200
|
17
|
+
&& !string.IsNullOrEmpty(request.downloadHandler.text))
|
16
18
|
{
|
17
19
|
var myID = request.downloadHandler.text;
|
18
|
-
|
20
|
+
//ここでIDを保存
|
19
|
-
|
21
|
+
}
|
20
22
|
}
|
21
23
|
}
|
22
24
|
```
|
2
誤字訂正
answer
CHANGED
@@ -45,7 +45,7 @@
|
|
45
45
|
|
46
46
|
}
|
47
47
|
|
48
|
-
//ランダム
|
48
|
+
//ランダムなIDを生成
|
49
49
|
function randomID($length = 10)
|
50
50
|
{
|
51
51
|
return substr(str_shuffle('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, $length);
|
1
修正
answer
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
SystemInfo.deviceUniqueIdentifierはUnityやOSのバージョンが変わると変わってしまうので一意のIDとしては使わない方がよいです。一番簡単で確実なのはID用のデータベースを設けて照合するといいと思います。
|
2
2
|
|
3
3
|
|
4
|
-
**UNITY**
|
4
|
+
**UNITY コードは未検証です**
|
5
5
|
```C#
|
6
6
|
public static IEnumerator getMyID(string url)
|
7
7
|
{
|
8
8
|
using (UnityWebRequest request = new UnityWebRequest(url))
|
9
9
|
{
|
10
|
-
request.method = UnityWebRequest.
|
10
|
+
request.method = UnityWebRequest.kHttpVerbGET;
|
11
11
|
request.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
|
12
12
|
|
13
13
|
yield return request.Send();
|