Skip to content

Commit 2a5a082

Browse files
authored
added Multipeer Connectivity Transport (#203)
* added Multipeer Connectivity Transport * added Multipeer Connectivity transport to the README file * removed Multipeer Connectivity transport package dependency
1 parent 858f6df commit 2a5a082

22 files changed

+864
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Check our [contribution guidelines](CONTRIBUTING.md) for information on how to c
3030
|**[WebSocket](/Transports/com.community.netcode.transport.websocket)**| Desktop, Mobile, WebGL | :heavy_check_mark: | :heavy_check_mark:||
3131
|**[Photon Realtime](/Transports/com.community.netcode.transport.photon-realtime)**| Desktop, Mobile, WebGL\** | :heavy_check_mark: | :heavy_check_mark: | |
3232
|**[Facepunch](/Transports/com.community.netcode.transport.facepunch)**| Steam | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
33+
|**[Multipeer Connectivity](/Transports/com.community.netcode.transport.multipeer-connectivity)**| iOS | :heavy_check_mark: | :heavy_check_mark: | |
3334

3435
\* Needs manual binary compilation.<br>
3536
\** Other platforms such as console platforms are also supported but require communication with Exit Games.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Changelog
2+
All notable changes to this package will be documented in this file. The format is based on Keep a Changelog
3+
4+
## 0.0.1
5+
This is the first release of Multipeer Connectivity Transport Package.

Transports/com.community.netcode.transport.multipeer-connectivity/CHANGELOG.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Transports/com.community.netcode.transport.multipeer-connectivity/Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System.IO;
2+
using UnityEditor;
3+
using UnityEditor.Callbacks;
4+
using UnityEditor.iOS.Xcode;
5+
6+
namespace Netcode.Transports.MultipeerConnectivity.Editor
7+
{
8+
public static class MultipeerConnectivityTransportBuildProcessor
9+
{
10+
[PostProcessBuild]
11+
public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
12+
{
13+
if (buildTarget == BuildTarget.iOS)
14+
{
15+
// For info.plist
16+
string plistPath = buildPath + "/Info.plist";
17+
PlistDocument plist = new();
18+
plist.ReadFromFile(plistPath);
19+
PlistElementDict rootDict = plist.root;
20+
21+
// For MPC
22+
rootDict.SetString("NSLocalNetworkUsageDescription", "For connecting to nearby devices");
23+
PlistElementArray array = rootDict.CreateArray("NSBonjourServices");
24+
array.AddString("_netcode-mpc._tcp");
25+
array.AddString("_netcode-mpc._udp");
26+
27+
File.WriteAllText(plistPath, plist.WriteToString());
28+
29+
// For build settings
30+
string projectPath = PBXProject.GetPBXProjectPath(buildPath);
31+
PBXProject project = new();
32+
project.ReadFromString(File.ReadAllText(projectPath));
33+
34+
string mainTargetGuid = project.GetUnityMainTargetGuid();
35+
string unityFrameworkTargetGuid = project.GetUnityFrameworkTargetGuid();
36+
37+
project.SetBuildProperty(mainTargetGuid, "ENABLE_BITCODE", "NO");
38+
project.SetBuildProperty(unityFrameworkTargetGuid, "ENABLE_BITCODE", "NO");
39+
40+
project.WriteToFile(projectPath);
41+
}
42+
}
43+
}
44+
}

Transports/com.community.netcode.transport.multipeer-connectivity/Editor/MultipeerConnectivityTransportBuildProcessor.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Netcode.Transports.MultipeerConnectivity.Editor",
3+
"rootNamespace": "Netcode.Transports.MultipeerConnectivity.Editor",
4+
"references": [],
5+
"includePlatforms": [
6+
"Editor"
7+
],
8+
"excludePlatforms": [],
9+
"allowUnsafeCode": false,
10+
"overrideReferences": false,
11+
"precompiledReferences": [],
12+
"autoReferenced": true,
13+
"defineConstraints": [],
14+
"versionDefines": [],
15+
"noEngineReferences": false
16+
}

Transports/com.community.netcode.transport.multipeer-connectivity/Editor/Netcode.Transports.MultipeerConnectivity.Editor.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
MIT License
2+
3+
Copyright (c) Holo Interactive
4+
5+
Copyright (c) 2021 Unity Technologies
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Transports/com.community.netcode.transport.multipeer-connectivity/LICENSE.md.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)