在 Unity 进程和另一个 C# 进程之间执行本地 IPC 的最快方法
Fastest way to do local IPC between a Unity process and another C# process
我想每秒从 C# 应用程序向我的 Unity 应用程序传送大约 30 次的大量数据。由于 Unity 不支持映射内存和管道,我想到了一个 tcp 套接字。如果通信仅在一台机器的范围内,这是否足够快?
可能从 2017 年开始,Unity 也支持 Managed plug-ins。
Unity3D也支持c++。
Native plugins are platform-specific native code libraries. They can access features like OS calls and third-party code libraries that would otherwise not be available to Unity. However, these libraries are not accessible to Unity’s tools in the way that managed libraries are. For example, if you forget to add a managed plugin file to the project, you will get standard compiler error messages. If you do the same with a native plugin, you will only see an error report when you try to run the project. More...
...和:
Unity has extensive support for native Plugins, which are libraries of native code written in C, C++, Objective-C, etc. Plugins allow your game code (written in Javascript or C#) to call functions from these libraries. This feature allows Unity to integrate with middleware libraries or existing C/C++ game code. More....
使用 C++ 代码,您可以自由地做任何您想做的事情,包括编写一个本机名称管道服务器,您的 C# 应用程序可以通过该服务器向其发送数据。
本地命名管道非常快,因为它们 运行 在内核模式下并且不像 TCP 那样通过网络层。
如果通信仅用于本地计算机,我建议使用 TCP 命名管道。
备选方案
命名管道的替代方法是:
- COM
- DDE
- 文件映射(包括共享内存,谢谢 Ben!)
- 邮槽
我想每秒从 C# 应用程序向我的 Unity 应用程序传送大约 30 次的大量数据。由于 Unity 不支持映射内存和管道,我想到了一个 tcp 套接字。如果通信仅在一台机器的范围内,这是否足够快?
可能从 2017 年开始,Unity 也支持 Managed plug-ins。
Unity3D也支持c++。
Native plugins are platform-specific native code libraries. They can access features like OS calls and third-party code libraries that would otherwise not be available to Unity. However, these libraries are not accessible to Unity’s tools in the way that managed libraries are. For example, if you forget to add a managed plugin file to the project, you will get standard compiler error messages. If you do the same with a native plugin, you will only see an error report when you try to run the project. More...
...和:
Unity has extensive support for native Plugins, which are libraries of native code written in C, C++, Objective-C, etc. Plugins allow your game code (written in Javascript or C#) to call functions from these libraries. This feature allows Unity to integrate with middleware libraries or existing C/C++ game code. More....
使用 C++ 代码,您可以自由地做任何您想做的事情,包括编写一个本机名称管道服务器,您的 C# 应用程序可以通过该服务器向其发送数据。
本地命名管道非常快,因为它们 运行 在内核模式下并且不像 TCP 那样通过网络层。
如果通信仅用于本地计算机,我建议使用 TCP 命名管道。
备选方案
命名管道的替代方法是:
- COM
- DDE
- 文件映射(包括共享内存,谢谢 Ben!)
- 邮槽