Sending Web Requests in Unity - UnityWebRequest

preview_player
Показать описание
Sending a HTTP request in Unity can be a little tricky. Watch this to avoid a few gotchas and streamline your development.

=========

About Tarodev:
Develop video games like a pro!

Рекомендации по теме
Комментарии
Автор

0:19 dude I've been driving me crazy and just had to add the SetRequestHeader Content-Type application/json. You're a wonderful person, you know that. Thank you very much!!!!

geekmode
Автор

THANK YOU!

Error I ran into a lot:

Just bear in mind guys, the Post request URL in this video uses Cloudflare... So I was getting a failed response for AGES. I think I needed to accept cookies in Unity? But I could not find how to do that, from memory it is just a Header that needs to be set.
After realizing this was the issue (by copying the text response into an html doc and looking at it in the browser...) I just linked it to my backend and everything worked great!

Also, UnityWebRequest uses NativeArrays, so make sure you put these in using statements or dispose of the UnityWebRequest once you are done to avoid memory leaks.

Example:
{
yield return req.SendWebRequest();
// Code here
}

Thank you very much Taro for the vid, I will probs use your CreateRequest function as a static so I can use it everywhere. Such a great implementation :)

Lith
Автор

My first contact ever with this channel, 12 seconds into this video, I pressed like.

mireazma
Автор

2:26 was the solution for me, thanks : 1 full day for an authorized GET request x)

mael_bomane
Автор

Thank You so much. I also spend a lot of time with the deserialization before i found this video. The video was really helpful

santig
Автор

Hi Taro, great vid! But could be even greater if you tested the code visually, maybe an idea for one of the next vids? Thanks :)

hassaanali
Автор

Hi! May I know how do we deserialize if the output json is nested? For example:
{
"user": {
"userID": "1234",
"username": "test,
}
}

deflatedbraincell
Автор

Thank you so much for the tutorial. I was wondering whether it would be possible to bypass the SSL certificate verification when making a POST request.

namhokoh
Автор

Tnx for the video.
I used unityWebRequest class as you did and it works perfectly on the editor.
However, after export to android, my server doesn't get any requests.

Do you know anything about this bug?

TheOmerbentov
Автор

Great stuff, not sure about what to do with this though.

I played a game once where they had an ingame forum where people posted their experience with specific things.

So like an item had a little ? and if you clicked that it leads you to the forum on that item where people tell you their experience about the item.

I figure it is probably doing something with this.

dibaterman
Автор

Could you createa video on creating a Dreamlo connection using Webrequest? Would be something lots of people look for and something niche that no one has done yet ;) ...plus I need it :D

ArtisticallyGinger
Автор

How can we send the secret and public keys for security connection?

jfiascaro
Автор

Hey I have a project I’m working on that uses UnityWebRequest and I’m stuck could you assist me?

yourlocalgamedev
Автор

Using this code, I kept getting this error: Argument exeception: JSON parse error: invalid value, Does anyone else have this problem? Thanks

DannyAstle
visit shbcf.ru