This commit is contained in:
2025-08-13 17:48:10 +08:00
parent 2fb74fe1d8
commit 0f801c92c8
2 changed files with 7 additions and 2 deletions

View File

@@ -24,7 +24,12 @@ namespace Stary.Evo
string postData = JsonConvert.SerializeObject(data);
try
{
using UnityWebRequest webRequest = UnityWebRequest.PostWwwForm(url, postData);
#if UNITY_2021_3_OR_NEWER
using UnityWebRequest webRequest = UnityWebRequest.Post(url, postData);
#else
using UnityWebRequest webRequest = UnityWebRequest.PostWwwForm(url, postData);
#endif
byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(postData);
webRequest.uploadHandler = new UploadHandlerRaw(postBytes);
webRequest.SetRequestHeader("Content-Type", "application/json");