团结3D看跌/删除HTTP方法 [英] Unity 3D Puts/Deletes http methods

查看:484
本文介绍了团结3D看跌/删除HTTP方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在想一个RPG我开发移植一个JavaScript的Web应用程序到C#Unity3D(免费/个人版)的。我有一个可扩展的,建于PHP Laravel 5.1,而我的游戏通过jQuery的HTTP调用交互单独的API。

I'm thinking of porting a JavaScript web app to C# Unity3D (Free / Personal Version) for an RPG I'm developing. I have an extensible, separate API built in PHP Laravel 5.1, which my game interacts with through jQuery http calls.

我需要继续做标准宁静的电话, GET 删除等内部的团结,但只找到 UnityEngine.WWW#这使得获得帖子

I need to continue making standard restful calls, get, post, put, delete, etc within Unity but have only found UnityEngine.WWW# which makes gets and posts.

这SO帖子共享其他可用的Unity3D的HTTP方法,但其中没有真正得到一个宁静的所有来电。我再次问,因为这是张贴在 2012 ,我还没有发现任何满足这一点的更新的文档

This SO Post shares the other available Unity3D http methods, but none which actually get all restful calls in one. I'm asking again because this was posted in 2012 and I haven't found any updates which satisfy this within the updated documentation.

最佳HTTP基本和最佳HTTP 为$ 45和$ 55但想会有其他自由选择。

There is Best HTTP Basic and Best HTTP for $45 and $55, but was thinking there would be other free options.

我失去了统一的范围内的东西,允许标准的宁静电话?

Am I missing something within Unity that allows for standard restful calls?

推荐答案

Web客户端的WebRequest 都提供统一,看起来像它只会与Pro版本的统一工作就像从 System.Net 命名空间的任何其他API。我不知道这个限制在Unity 5.改变了他们支持在你的问题中提到的所有这些宁静的电话。

WebClient and WebRequest are both available in Unity and looks like it will only work with Pro Unity version just like any other API from the System.Net namespace. I don't know if this restriction has changed in Unity 5. They support all those restful calls mentioned in your question.

统一增加了一个名为新的API的 UnityWebRequest 版本的 5.2 5.3 。它被设计用来替换 WWW 及其支持的所有的REST风格在你的问题中列出的电话。下面是例子为每一个。这并不是一个完整的实施例。你可以在我上面提供的链接完整的例子。

Unity Added a new API called UnityWebRequest in version 5.2 with mobile platform support in 5.3. It was designed to replace WWW and it supports all the restfull calls listed in your question. Below are example for each one. This is not a full example. You can find full examples in the link I provided above.

//Get
UnityWebRequest get = UnityWebRequest.Get("http://www.myserver.com/foo.txt");

//Post
UnityWebRequest post = UnityWebRequest.Post("http://www.myserver.com/foo.txt","Hello");

//Put
byte[] myData = System.Text.Encoding.UTF8.GetBytes("This is some test data");
UnityWebRequest put = UnityWebRequest.Put("http://www.my-server.com/upload", myData);

//Delete
UnityWebRequest delete = UnityWebRequest.Delete("http://www.myserver.com/foo.txt");

这篇关于团结3D看跌/删除HTTP方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆