Unity 的 TCP 客户端
如何在Unity3d中编写一个TCP客户端,它不断地从服务器套接字读取数据并打印到控制台或更新某些文本框?
How to write a TCP client in Unity3d which reads data constantly from a server socket and prints to the console or updates on some text boxes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在unity3d中创建TCP客户端与在c#中开发几乎相同,您可以使用几乎所有.net类(从最新的unity 3.5开始为4.0),在使用类之前请先从< a href="http://unity3d.com/support/documentation/ScriptReference/MonoCompatibility" rel="nofollow">此页面。
如果 Mono 不支持该类,只需从 .net 库中拖动与该类对应的相关 dll 即可。此外,您还有两种方法可以做到这一点,使用 .net 类统一编写整个逻辑。或者制作一个 dll 并将其导入到 unity 中并使用该 dll 来处理 TCP 工作。就性能而言,没有区别,一切都取决于您的喜好。
Creating a TCP client in unity3d is nearly the same as developing it in c#, you can use almost all the classes of .net (4.0 as of the latest unity 3.5), still before you use a class look for the support in mono from this page.
If the class is not supported in mono, just drag the respected dll corresponding to the class from the .net library. Also you have two methods to do it, write the whole logic using .net classes in unity. or make a dll of it and import it into unity and use that dll for processing TCP works. In terms of performance there is no difference, all depends on ur preference.
这可能是一个很好的起点:
http:// /answers.unity3d.com/questions/15422/unity-project-and-3rd-party-apps.html
This could be a good starting point:
http://answers.unity3d.com/questions/15422/unity-project-and-3rd-party-apps.html