当前位置:网站首页>Unity is connected to the weather system
Unity is connected to the weather system
2022-07-04 05:01:00 【Jiubencai】

I used the weather forecast interface of Gaode open platform to access Unity in .
Gaud open platform | Gould map API Gaode open platform official website https://lbs.amap.com/ After registering Gaode open platform , After moving the mouse to the avatar in the upper right corner, you will find application management , Click on Application Management , Then click create new application .

Click Add ,Web The service can use the weather API.

After the creation, you can see the corresponding Key

Then we can easily get the weather data by looking at the development documents .
Weather query API Service address :
URL | https://restapi.amap.com/v3/weather/weatherInfo?parameters |
Request mode | GET |
parameters The parameters represented include mandatory parameters and optional parameters . All parameters use the and character (&) separation . The following list enumerates these parameters and their usage rules .
- Request parameters
Parameter name | meaning | Rule description | Whether must | The default value | |
|---|---|---|---|---|---|
key | Request service permission id | The user is on the official website of Gaode map apply web service API type KEY | Required | nothing | |
city | City Code | Enter the name of the city adcode,adcode Information is available for reference City code table | Required | nothing | |
extensions | Weather type | Optional value :base/all base: Return to the real weather all: Return to the weather forecast | Optional | nothing | |
output | Returns the format | Optional value :JSON,XML | Optional | JSON | |
Here is the data I got .


Note that real-time weather and weather forecast are two interfaces .
Code example , This code can get the weather json data , adopt json The obtained data can be displayed in UI Yes .
IEnumerator GetBase()
{
UnityWebRequest webRequest = UnityWebRequest.Get(urlBase);
yield return webRequest.SendWebRequest();
if (webRequest.isHttpError || webRequest.isNetworkError)
Debug.Log(webRequest.error);
else
{
// Debug.Log(webRequest.downloadHandler.text);
}
}
边栏推荐
猜你喜欢

中科磐云—D模块解析以及评分标准

Zhengzhou zhengqingyuan Culture Communication Co., Ltd.: seven marketing skills for small enterprises

2022广东省赛——编码信息获取 解析flag

模拟小根堆

ADB tools

Capturing and sorting out external Fiddler -- Conversation bar and filter

Headache delayed double deletion

Notes on the paper "cross view transformers for real time map view semantic segmentation"

自动化测试selenium基础篇——webdriverAPI

Customize a pager needed in your project
随机推荐
[matlab] matlab simulates digital baseband transmission system - digital baseband transmission system
Deep understanding of redis -- bloomfilter
A summary of the 8544 problem that SolidWorks Standard cannot obtain a license
Headache delayed double deletion
在代码中使用度量单位,从而生活更美好
简单g++和gdb调试
COMP1721 Creating Classes
Zhongke Panyun - data analysis and forensics packet flag
Unity中RampTex介绍和应用: 溶解特效优化
【MATLAB】通信信号调制通用函数 — 低通滤波器
Maui introductory tutorial series (5.xaml and page introduction)
RPC - gRPC简单的demo - 学习/实践
Binary search tree
Sécurité du réseau dans les écoles professionnelles secondaires - preuve de mémoire
附件四:攻击方评分标准.docx
《Cross-view Transformers for real-time Map-view Semantic Segmentation》论文笔记
NTFS security permissions
Rollup各组件作用
[技术发展-25]:广播电视网、互联网、电信网、电网四网融合技术
[go] database framework Gorm