├── Assets ├── README.md ├── README.md.meta ├── Scripts.meta ├── Scripts │ ├── BehaviourManager.meta │ ├── BehaviourManager │ │ ├── BehaviourManager.cs │ │ └── BehaviourManager.cs.meta │ ├── Native.meta │ ├── Native │ │ ├── MessageBox.cs │ │ └── MessageBox.cs.meta │ ├── RakNet.meta │ ├── RakNet │ │ ├── BaseNetworkClient.cs │ │ ├── BaseNetworkClient.cs.meta │ │ ├── BaseNetworkServer.cs │ │ ├── BaseNetworkServer.cs.meta │ │ ├── Conversion.meta │ │ ├── Conversion │ │ │ ├── FixedFloat.cs │ │ │ ├── FixedFloat.cs.meta │ │ │ ├── UIntDecimal.cs │ │ │ ├── UIntDecimal.cs.meta │ │ │ ├── UIntDouble.cs │ │ │ ├── UIntDouble.cs.meta │ │ │ ├── UIntFloat.cs │ │ │ └── UIntFloat.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BaseNetworkClientDebugEditorWindow.cs │ │ │ ├── BaseNetworkClientDebugEditorWindow.cs.meta │ │ │ ├── BaseNetworkClientEditor.cs │ │ │ ├── BaseNetworkClientEditor.cs.meta │ │ │ ├── BaseNetworkServerDebugEditorWindow.cs │ │ │ ├── BaseNetworkServerDebugEditorWindow.cs.meta │ │ │ ├── BaseNetworkServerEditor.cs │ │ │ ├── BaseNetworkServerEditor.cs.meta │ │ │ ├── StopGameOnRecompiling.cs │ │ │ └── StopGameOnRecompiling.cs.meta │ │ ├── QueryProtocol.meta │ │ ├── QueryProtocol │ │ │ ├── QueryInfo.cs │ │ │ ├── QueryInfo.cs.meta │ │ │ ├── QueryProtocol.cs │ │ │ └── QueryProtocol.cs.meta │ │ ├── RakNet_Enums.cs │ │ ├── RakNet_Enums.cs.meta │ │ ├── RakNet_Native.cs │ │ ├── RakNet_Native.cs.meta │ │ ├── RakNet_Packet.cs │ │ ├── RakNet_Packet.cs.meta │ │ ├── RakNet_Peer.cs │ │ ├── RakNet_Peer.cs.meta │ │ ├── x86.meta │ │ ├── x86 │ │ │ ├── RakNet_x86.dll │ │ │ └── RakNet_x86.dll.meta │ │ ├── x86_64.meta │ │ └── x86_64 │ │ │ ├── RakNet_x64.dll │ │ │ └── RakNet_x64.dll.meta │ ├── Readme.meta │ ├── Readme │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── ReadmeEditor.cs │ │ │ └── ReadmeEditor.cs.meta │ │ ├── Icons.meta │ │ ├── Icons │ │ │ ├── Help_Icon.png │ │ │ ├── Help_Icon.png.meta │ │ │ ├── raknet.png │ │ │ └── raknet.png.meta │ │ ├── Layout.wlt │ │ ├── Layout.wlt.meta │ │ ├── Readme.asset │ │ ├── Readme.asset.meta │ │ ├── Readme.cs │ │ └── Readme.cs.meta │ ├── TestCode.meta │ └── TestCode │ │ ├── Client.meta │ │ ├── Client │ │ ├── TestClient.cs │ │ └── TestClient.cs.meta │ │ ├── Server.meta │ │ ├── Server │ │ ├── TestServer.cs │ │ └── TestServer.cs.meta │ │ ├── Shared.meta │ │ └── Shared │ │ ├── ClientData.cs │ │ ├── ClientData.cs.meta │ │ ├── PacketIDs.cs │ │ ├── PacketIDs.cs.meta │ │ ├── packet_ClientData.cs │ │ └── packet_ClientData.cs.meta ├── TestCLSV.unity └── TestCLSV.unity.meta ├── Library ├── APIUpdater │ └── project-dependencies.graph ├── AnnotationManager ├── AssetImportState ├── BuildSettings.asset ├── CurrentLayout-default.dwlt ├── EditorOnlyScriptingSettings.json ├── EditorSnapSettings.asset ├── EditorUserBuildSettings.asset ├── EditorUserSettings.asset ├── InspectorExpandedItems.asset ├── LastSceneManagerSetup.txt ├── LibraryFormatVersion.txt ├── MonoManager.asset ├── SceneVisibilityState.asset ├── ScriptMapper ├── SourceAssetDB-lock ├── SpriteAtlasDatabase.asset ├── Style.catalog └── expandedItems ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset └── README.md /Assets/README.md: -------------------------------------------------------------------------------- 1 | # RakNet For Unity3D 2 | This is an updated version of the wrapper for the native library of the RakNet network engine. 3 | -------------------------------------------------------------------------------- /Assets/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ef1d22c8eabd88449e70471280631c1 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8586b4e37dd36744a9f1384cbb69127 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/BehaviourManager.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c03cb61cae124a4ca215f60d70d160d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/BehaviourManager/BehaviourManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | public interface ITickUpdate 5 | { 6 | void TickUpdate(float dt); 7 | } 8 | 9 | public interface IFrameUpdate 10 | { 11 | void FrameUpdate(float dt); 12 | } 13 | 14 | public interface IAfterFrameUpdate 15 | { 16 | void AfterFrameUpdate(float dt); 17 | } 18 | 19 | [DefaultExecutionOrder(int.MinValue)] 20 | [DisallowMultipleComponent] 21 | //Behavior Manager is a handy tool I wrote to add a little optimization to update calls. 22 | //See https://blog.theknightsofunity.com/monobehavior-calls-optimization/ for details 23 | //Subscribe! My Youtube channel https://www.youtube.com/channel/UCPQ04Xpbbw2uGc1gsZtO3HQ 24 | 25 | //ATTENTION! WRITTEN EVERYTHING FOR MYSELF! IF YOU DO NOT LIKE THE IMPLEMENTATION YOU CAN WRITE YOUR OWN 26 | 27 | public class BehaviourManager : MonoBehaviour 28 | { 29 | public static bool Initialized { get; private set; } = false; 30 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] 31 | static void Initialize() 32 | { 33 | if (Initialized) 34 | return; 35 | 36 | GameObject go = new GameObject("BehaviourManager"); 37 | Instance = go.AddComponent(); 38 | go.hideFlags = HideFlags.NotEditable | HideFlags.DontSave; 39 | DontDestroyOnLoad(go); 40 | Initialized = true; 41 | } 42 | 43 | private void Awake() 44 | { 45 | /* This fragment can be cut 46 | CommandHandler.RegisterCommand("_interfaces_info", delegate { 47 | Debug.Log( 48 | "\nInterfaces performance time\n"+ 49 | "IFrameUpdate = " + frameupdate_behaviours.Count + " ("+IFrameUpdateExecTime+" ms) Calls = "+FrameCalls+"\n" + 50 | "IAfterFrameUpdate = " + afterframeupdate_behaviours.Count + " (" + IAfterFrameUpdateExecTime + " ms) Calls = " + AfterFrameCalls + "\n" + 51 | "ITickUpdate = " + tickupdate_behaviours.Count + " (" + ITickUpdateExecTime + " ms) Calls = " + TickCalls+"\nTotal Calls = "+(FrameCalls+AfterFrameCalls+TickCalls) 52 | ); ; }, "-"); 53 | 54 | CommandHandler.RegisterCommand("_behaviour_types", delegate { 55 | Debug.Log("\nRegistered Behaviour Types"); 56 | for(int i = 0; i < behaviours_names.Count; i++) 57 | { 58 | Debug.Log(behaviours_names[i]); 59 | } 60 | }, "-"); 61 | */ 62 | } 63 | 64 | public static BehaviourManager Instance; 65 | public List behaviours_names { get; private set; } = new List(); 66 | public List frameupdate_behaviours { get; private set; } = new List(); 67 | public List afterframeupdate_behaviours { get; private set; } = new List(); 68 | public List tickupdate_behaviours { get; private set; } = new List(); 69 | 70 | public static bool Access() 71 | { 72 | if (!Instance) 73 | { 74 | Debug.LogError("BehaviourManager is not initialized!"); 75 | } 76 | return Instance; 77 | } 78 | 79 | public static void RegisterBehaviour(IFrameUpdate behaviour) 80 | { 81 | if (!Access()) 82 | { 83 | return; 84 | } 85 | string type_name = (behaviour as MonoBehaviour).GetType().Name; 86 | //Add type name 87 | if (!Instance.behaviours_names.Contains(type_name)) 88 | { 89 | Instance.behaviours_names.Add(type_name); 90 | } 91 | 92 | Instance.frameupdate_behaviours.Add(behaviour); 93 | } 94 | public static void RegisterBehaviour(ITickUpdate behaviour) 95 | { 96 | if (!Access()) 97 | { 98 | return; 99 | } 100 | 101 | string type_name = (behaviour as MonoBehaviour).GetType().Name; 102 | //Add type name 103 | if (!Instance.behaviours_names.Contains(type_name)) 104 | { 105 | Instance.behaviours_names.Add(type_name); 106 | } 107 | 108 | Instance.tickupdate_behaviours.Add(behaviour); 109 | } 110 | public static void RegisterBehaviour(IAfterFrameUpdate behaviour) 111 | { 112 | if (!Access()) 113 | { 114 | return; 115 | } 116 | 117 | string type_name = (behaviour as MonoBehaviour).GetType().Name; 118 | //Add type name 119 | if (!Instance.behaviours_names.Contains(type_name)) 120 | { 121 | Instance.behaviours_names.Add(type_name); 122 | } 123 | 124 | Instance.afterframeupdate_behaviours.Add(behaviour); 125 | } 126 | public static void UnregisterBehaviour(IFrameUpdate behaviour) 127 | { 128 | if (!Access()) 129 | { 130 | return; 131 | } 132 | 133 | string type_name = (behaviour as MonoBehaviour).GetType().Name; 134 | //Add type name 135 | if (Instance.behaviours_names.Contains(type_name)) 136 | { 137 | Instance.behaviours_names.Remove(type_name); 138 | } 139 | 140 | Instance.frameupdate_behaviours.Remove(behaviour); 141 | } 142 | public static void UnregisterBehaviour(ITickUpdate behaviour) 143 | { 144 | if (!Access()) 145 | { 146 | return; 147 | } 148 | 149 | string type_name = (behaviour as MonoBehaviour).GetType().Name; 150 | //Add type name 151 | if (Instance.behaviours_names.Contains(type_name)) 152 | { 153 | Instance.behaviours_names.Remove(type_name); 154 | } 155 | 156 | Instance.tickupdate_behaviours.Remove(behaviour); 157 | } 158 | public static void UnregisterBehaviour(IAfterFrameUpdate behaviour) 159 | { 160 | if (!Access()) 161 | { 162 | return; 163 | } 164 | 165 | string type_name = (behaviour as MonoBehaviour).GetType().Name; 166 | //Add type name 167 | if (Instance.behaviours_names.Contains(type_name)) 168 | { 169 | Instance.behaviours_names.Remove(type_name); 170 | } 171 | 172 | Instance.afterframeupdate_behaviours.Remove(behaviour); 173 | } 174 | 175 | public static ulong FrameCalls = 0; 176 | System.Diagnostics.Stopwatch IFrameWatch = new System.Diagnostics.Stopwatch(); 177 | public static long IFrameUpdateExecTime { get; private set; } 178 | public static float frame_delta { get; private set; } = 0; 179 | private void Update() 180 | { 181 | frame_delta = Time.deltaTime; 182 | IFrameWatch.Restart(); 183 | UnityEngine.Profiling.Profiler.BeginSample("BehaviourManager FrameUpdate"); 184 | for (int i = 0; i < frameupdate_behaviours.Count; i++) 185 | { 186 | frameupdate_behaviours[i].FrameUpdate(frame_delta); 187 | FrameCalls++; 188 | } 189 | UnityEngine.Profiling.Profiler.EndSample(); 190 | IFrameWatch.Stop(); 191 | IFrameUpdateExecTime = IFrameWatch.ElapsedMilliseconds; 192 | } 193 | 194 | public static ulong AfterFrameCalls = 0; 195 | System.Diagnostics.Stopwatch IAfterFrameWatch = new System.Diagnostics.Stopwatch(); 196 | public static long IAfterFrameUpdateExecTime { get; private set; } 197 | private void LateUpdate() 198 | { 199 | IAfterFrameWatch.Restart(); 200 | UnityEngine.Profiling.Profiler.BeginSample("BehaviourManager AfterFrameUpdate"); 201 | for (int i = 0; i < afterframeupdate_behaviours.Count; i++) 202 | { 203 | afterframeupdate_behaviours[i].AfterFrameUpdate(frame_delta); 204 | AfterFrameCalls++; 205 | } 206 | UnityEngine.Profiling.Profiler.EndSample(); 207 | IAfterFrameWatch.Stop(); 208 | IAfterFrameUpdateExecTime = IAfterFrameWatch.ElapsedMilliseconds; 209 | } 210 | 211 | public static ulong TickCalls = 0; 212 | System.Diagnostics.Stopwatch ITickUpdateWatch = new System.Diagnostics.Stopwatch(); 213 | public static long ITickUpdateExecTime { get; private set; } 214 | private void FixedUpdate() 215 | { 216 | ITickUpdateWatch.Restart(); 217 | UnityEngine.Profiling.Profiler.BeginSample("BehaviourManager TickUpdate"); 218 | for (int i = 0; i < tickupdate_behaviours.Count; i++) 219 | { 220 | tickupdate_behaviours[i].TickUpdate(Time.fixedDeltaTime); 221 | TickCalls++; 222 | } 223 | UnityEngine.Profiling.Profiler.EndSample(); 224 | ITickUpdateWatch.Stop(); 225 | ITickUpdateExecTime = ITickUpdateWatch.ElapsedMilliseconds; 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /Assets/Scripts/BehaviourManager/BehaviourManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39ac35660472c5d43973435a3a7cbc66 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Native.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67c5dd60b6e6efa4b835c044bbbcd69e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Native/MessageBox.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | namespace Native 3 | { 4 | public static class MessageBox 5 | { 6 | public enum Type : long 7 | { 8 | OK = 0x00000000L, 9 | OK_CANCEL = 0x00000001L, 10 | ABORT_RETRY_IGNORE = 0x00000002L, 11 | YES_NO_CANCEL = 0x00000003L, 12 | YES_NO = 0x00000004L, 13 | RETRY_CANCEL = 0x00000005L, 14 | CANCEL_TRY_CONTINUE = 0x00000006L, 15 | ICON_ERROR = 0x00000010L, 16 | ICON_WARNING = 0x00000030L, 17 | ICON_INFORMATION = 0x00000040L, 18 | ICON_ASTERISK = 0x00000040L, 19 | SET_FOREGROUND = 0x00010000L, 20 | NO_FOCUS = 0x00008000L 21 | } 22 | 23 | public static int Show(string title, string text, Type type) 24 | { 25 | return _callNative(0, text, title, (long)type); 26 | } 27 | 28 | public static int Show(string title, string text) 29 | { 30 | return Show( title, text, Type.SET_FOREGROUND); 31 | } 32 | 33 | public static int Show(string text, Type type) 34 | { 35 | return Show( "", text, type); 36 | } 37 | 38 | public static int Show(string text) 39 | { 40 | return Show("", text, Type.SET_FOREGROUND); 41 | } 42 | 43 | 44 | [DllImport("user32.dll", EntryPoint = "MessageBox", SetLastError = true)] 45 | private static extern int _callNative(int hwnd, string text, string title, long type); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Assets/Scripts/Native/MessageBox.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edfb6f5767cb71a4c95607b97e2783c4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ab3769b84b52ea49aa3b67d9ab2dedd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/BaseNetworkClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using UnityEngine; 4 | using static RakNet_Enums; 5 | 6 | //Subscribe! My Youtube channel https://www.youtube.com/channel/UCPQ04Xpbbw2uGc1gsZtO3HQ 7 | 8 | //ATTENTION! WRITTEN EVERYTHING FOR MYSELF! IF YOU DO NOT LIKE THE IMPLEMENTATION YOU CAN WRITE YOUR OWN 9 | 10 | 11 | /// 12 | /// Base network client class 13 | /// 14 | public class BaseNetworkClient : MonoBehaviour,ITickUpdate 15 | { 16 | public RakNet_Peer client_peer; 17 | public QueryProtocol Query { get; private set; } = new QueryProtocol(QueryProtocolMode.Client); 18 | public bool IsConnected { get; private set; } = false; 19 | public bool IsConnecting { get; private set; } = false; 20 | public int Timeout { get; private set; } = 999; 21 | public string Address => client_peer != null ? client_peer.address : "-"; 22 | public int Port => client_peer != null ? client_peer.port : -1; 23 | private string disconnect_reason = string.Empty; 24 | 25 | private void Awake() 26 | { 27 | BehaviourManager.RegisterBehaviour(this); 28 | Query.Initialize(); 29 | OnInit(); 30 | } 31 | 32 | public void RequestQuery(string address,int port) 33 | { 34 | Query.RequestQuery(address, port+1); 35 | } 36 | 37 | public void Connect(string address = "127.0.0.1", int port = 7777, int retries = 10, int timeout = 15) 38 | { 39 | if (client_peer == null) 40 | { 41 | Timeout = timeout; 42 | disconnect_reason = string.Empty; 43 | client_peer = RakNet_Peer.Connect(address, port, retries, timeout); 44 | IsConnecting = true; 45 | OnConnecting(address, port); 46 | OnConnectingEvent?.Invoke(address, port); 47 | } 48 | else 49 | { 50 | Debug.LogWarning("[Client] Is already running..."); 51 | } 52 | } 53 | 54 | public void Disconnect(DisconnectionType disconnectionType = DisconnectionType.Unknown) 55 | { 56 | if (client_peer != null) 57 | { 58 | client_peer.Shutdown(); 59 | IsConnected = IsConnecting = false; 60 | if (disconnectionType != DisconnectionType.Unknown) 61 | { 62 | OnDisconnected(client_peer.address, client_peer.port, disconnectionType, disconnect_reason); 63 | OnDisconnectedEvent?.Invoke(client_peer.address, client_peer.port, disconnectionType, disconnect_reason); 64 | } 65 | else if (disconnectionType == DisconnectionType.Unknown) 66 | { 67 | OnDisconnected(client_peer.address, client_peer.port, DisconnectionType.ByUser, string.Empty); 68 | OnDisconnectedEvent?.Invoke(client_peer.address, client_peer.port, DisconnectionType.ByUser, string.Empty); 69 | } 70 | if (RakNet_Peer.debugLevel >= RakDebugLevel.Low) 71 | { 72 | Debug.Log("[Client] Disconnected... (" + disconnectionType + ")"); 73 | } 74 | client_peer = null; 75 | } 76 | } 77 | 78 | public void TickUpdate(float dt) 79 | { 80 | if (client_peer != null) 81 | { 82 | //while there is data in the buffer, read it 83 | while (client_peer != null && client_peer.HasReceived(out ArraySegment data)) 84 | { 85 | ProcessPacket(data); 86 | } 87 | } 88 | ClientUpdate(); 89 | Query?.Update(); 90 | } 91 | 92 | private void ProcessPacket(ArraySegment data) 93 | { 94 | bool default_id = data.Array[0] < 134; 95 | 96 | if(data.Array[0] == 134) 97 | { 98 | string text = Encoding.UTF8.GetString(data.Array, 1, data.Count - 1); 99 | if (RakNet_Peer.debugLevel >= RakDebugLevel.Low) 100 | { 101 | Debug.Log("[Client] Disconnect reason " + (text.Length > 0 ? text : "empty")); 102 | } 103 | disconnect_reason = text; 104 | return; 105 | } 106 | 107 | if (default_id) 108 | { 109 | switch ((RakNetPacketID)data.Array[0]) 110 | { 111 | case RakNetPacketID.CONNECTION_REQUEST_ACCEPTED: 112 | IsConnecting = false; 113 | IsConnected = true; 114 | Debug.Log("[Client] Connected to " + client_peer.address + ":" + client_peer.port); 115 | OnConnected(client_peer.address, client_peer.port); 116 | OnConnectedEvent?.Invoke(client_peer.address, client_peer.port); 117 | break; 118 | 119 | case RakNetPacketID.NO_FREE_INCOMING_CONNECTIONS: 120 | Disconnect(DisconnectionType.ServerIsFull); 121 | break; 122 | 123 | case RakNetPacketID.CONNECTION_ATTEMPT_FAILED: 124 | Disconnect(DisconnectionType.Timeout); 125 | break; 126 | 127 | case RakNetPacketID.CONNECTION_LOST: 128 | Disconnect(DisconnectionType.ConnectionLost); 129 | break; 130 | 131 | case RakNetPacketID.DISCONNECTION_NOTIFICATION: 132 | Disconnect(DisconnectionType.ConnectionClosed); 133 | break; 134 | } 135 | } 136 | else 137 | { 138 | OnReceivedData(data); 139 | } 140 | } 141 | 142 | /// 143 | /// Send data to server 144 | /// 145 | public void SendData 146 | ( 147 | byte packet_id, 148 | byte[] data, 149 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 150 | PacketReliability reliability = PacketReliability.RELIABLE, 151 | NetChannel channel = NetChannel.NET_EVENTS 152 | ) 153 | { 154 | if (IsConnected) 155 | { 156 | client_peer?.BeginWrite(packet_id); 157 | client_peer?.WriteBytes(data); 158 | client_peer?.SendToServer(priority, reliability, channel); 159 | } 160 | else 161 | { 162 | if (RakNet_Peer.debugLevel >= RakDebugLevel.Low) 163 | { 164 | Debug.LogError("[Client] Is not connected!"); 165 | } 166 | } 167 | } 168 | 169 | /// 170 | /// Send rpc to server 171 | /// 172 | public void SendRPC 173 | ( 174 | byte packet_id, 175 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 176 | PacketReliability reliability = PacketReliability.RELIABLE, 177 | NetChannel channel = NetChannel.NET_EVENTS 178 | ) 179 | { 180 | if (IsConnected) 181 | { 182 | client_peer?.BeginWrite(); 183 | client_peer?.Write(packet_id); 184 | client_peer?.SendToServer(priority, reliability, channel); 185 | } 186 | else 187 | { 188 | if (RakNet_Peer.debugLevel >= RakDebugLevel.Low) 189 | { 190 | Debug.LogError("[Client] Is not connected!"); 191 | } 192 | } 193 | } 194 | 195 | /// 196 | /// Send data to server 197 | /// 198 | public void SendData 199 | ( 200 | byte[] data, 201 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 202 | PacketReliability reliability = PacketReliability.RELIABLE, 203 | NetChannel channel = NetChannel.NET_EVENTS 204 | ) 205 | { 206 | if (IsConnected) 207 | { 208 | client_peer?.BeginWrite(); 209 | client_peer?.WriteBytes(data); 210 | client_peer?.SendToServer(priority, reliability, channel); 211 | } 212 | else 213 | { 214 | if (RakNet_Peer.debugLevel >= RakDebugLevel.Low) 215 | { 216 | Debug.LogError("[Client] Is not connected!"); 217 | } 218 | } 219 | } 220 | 221 | public string GetNetworkStats() 222 | { 223 | return client_peer != null ? client_peer.GetNetStatsString() : "-"; 224 | } 225 | public int GetPingAverage() { return client_peer != null ? client_peer.GetPingAverage() : 0; } 226 | public int GetPingLast() { return client_peer != null ? client_peer.GetPingAverage() : 0; } 227 | public int GetPingLowest() { return client_peer != null ? client_peer.GetPingAverage() : 0; } 228 | public ulong GetNetStat(RNSPerSecondMetrics metrics) { return client_peer != null ? client_peer.GetNetStat(metrics) : 0; } 229 | public ulong GetNetStatLastSecond(RNSPerSecondMetrics metrics) { return client_peer != null ? client_peer.GetNetStatLastSecond(metrics) : 0; } 230 | public float GetNetStatOut() { return client_peer != null ? client_peer.GetNetStat(RNSPerSecondMetrics.ACTUAL_BYTES_SENT) : 0; } 231 | public float GetNetStatIn() { return client_peer != null ? client_peer.GetNetStat(RNSPerSecondMetrics.ACTUAL_BYTES_RECEIVED) : 0; } 232 | public float GetNetStatOutPerSec() { return client_peer != null ? client_peer.GetNetStatLastSecond(RNSPerSecondMetrics.ACTUAL_BYTES_SENT) : 0; } 233 | public float GetNetStatInPerSec() { return client_peer != null ? client_peer.GetNetStatLastSecond(RNSPerSecondMetrics.ACTUAL_BYTES_RECEIVED) : 0; } 234 | public float GetLoss() { return client_peer != null ? Mathf.Clamp(client_peer.GetNetStats().packetlossLastSecond * 1000f,0,100) : 0; } 235 | private void OnDestroy(){ BehaviourManager.UnregisterBehaviour(this); client_peer?.Shutdown(); } 236 | 237 | 238 | public virtual void OnInit() { } 239 | public virtual void ClientUpdate() { } 240 | /// 241 | /// Event on connecting (address,port) 242 | /// 243 | public Action OnConnectingEvent; 244 | public virtual void OnConnecting(string address, int port) { } 245 | public virtual void OnConnected(string address, int port) { } 246 | /// 247 | /// Event on connected (address,port) 248 | /// 249 | public Action OnConnectedEvent; 250 | public virtual void OnDisconnected(string address, int port, DisconnectionType type, string reason) { } 251 | /// 252 | /// Event on disconnected (address,port,disconnectiontype,reason) 253 | /// 254 | public Action OnDisconnectedEvent; 255 | public virtual void OnReceivedData(ArraySegment data) { } 256 | } 257 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/BaseNetworkClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 138bd766dde3600499e41ad1219b45fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/BaseNetworkServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Unity.Collections; 4 | using Unity.Jobs; 5 | using UnityEngine; 6 | using static RakNet_Enums; 7 | 8 | public class ConnectionInfo 9 | { 10 | public ulong guid; 11 | public string address; 12 | private int old_packets_received; 13 | public int packets_received; 14 | 15 | public int PacketsPerSec() 16 | { 17 | int diff = packets_received - old_packets_received; 18 | old_packets_received = packets_received; 19 | return diff; 20 | } 21 | 22 | public ConnectionInfo(ulong guid,string address) 23 | { 24 | this.guid = guid; 25 | this.address = address; 26 | this.old_packets_received = 0; 27 | this.packets_received = 0; 28 | } 29 | } 30 | 31 | //Subscribe! My Youtube channel https://www.youtube.com/channel/UCPQ04Xpbbw2uGc1gsZtO3HQ 32 | 33 | //ATTENTION! WRITTEN EVERYTHING FOR MYSELF! IF YOU DO NOT LIKE THE IMPLEMENTATION YOU CAN WRITE YOUR OWN 34 | 35 | 36 | /// 37 | /// Base network server class 38 | /// 39 | public class BaseNetworkServer : MonoBehaviour, ITickUpdate 40 | { 41 | public RakNet_Peer server_peer; 42 | public QueryProtocol Query { get; private set; } = new QueryProtocol(QueryProtocolMode.Server); 43 | public bool IsStarted => server_peer != null ? server_peer.state == PeerState.RunAsServer : false; 44 | public string Address => server_peer != null ? server_peer.address : "-"; 45 | public int Port => server_peer != null ? server_peer.port : -1; 46 | public List connections = new List(); 47 | 48 | 49 | private void Awake() 50 | { 51 | BehaviourManager.RegisterBehaviour(this); 52 | OnInit(); 53 | } 54 | 55 | public bool StartServer(string bind_to_address = "127.0.0.1", int port = 7777, int maxPlayers = 32) 56 | { 57 | OnPreServerInit(); 58 | if (server_peer == null) 59 | { 60 | server_peer = RakNet_Peer.CreateServer(bind_to_address, port, maxPlayers); 61 | 62 | if (server_peer != null) 63 | { 64 | Query.info.maxPlayers = (byte)maxPlayers; 65 | Query.info.version = Application.version; 66 | try 67 | { 68 | Query.Initialize(port + 1); 69 | } 70 | catch 71 | { 72 | Debug.LogError("Query initialized failure! Please port " + (port + 1)); 73 | } 74 | OnServerInitSuccess(bind_to_address, port); 75 | Debug.Log("Server started -> " + bind_to_address + ":" + port + " Max Players: " + maxPlayers + "\nGame/Engine version -> " + Application.version + "/" + Application.unityVersion); 76 | return true; 77 | } 78 | else 79 | { 80 | OnServerInitFailed(); 81 | return false; 82 | } 83 | } 84 | else 85 | { 86 | Debug.LogWarning("[Server] Is already running..."); 87 | return false; 88 | } 89 | } 90 | 91 | public void StopServer() 92 | { 93 | for (int i = 0; i < connections.Count; i++) 94 | { 95 | Kick(connections[i].guid, "Server shutting down!"); 96 | } 97 | if (server_peer != null) 98 | { 99 | OnServerShutdown(); 100 | server_peer.Shutdown(); 101 | server_peer = null; 102 | } 103 | 104 | Query.Shutdown(); 105 | } 106 | 107 | public void TickUpdate(float dt) 108 | { 109 | if (server_peer != null) 110 | { 111 | //while there is data in the buffer, read it 112 | while (server_peer != null && server_peer.HasReceived(out ulong guid, out ArraySegment data)) 113 | { 114 | ProcessPacket(guid, data); 115 | } 116 | } 117 | ServerUpdate(); 118 | if(_checkConnectionsTimer < Time.fixedTime) 119 | { 120 | _checkConnectionsTimer = Time.fixedTime + 1f; 121 | CheckConnections(); 122 | } 123 | } 124 | 125 | float _checkConnectionsTimer = 0; 126 | 127 | public const int MAX_PACKETS_PER_SECOND = 100; 128 | 129 | void CheckConnections() 130 | { 131 | for (int i = 0; i < connections.Count; i++) 132 | { 133 | int packets_per_sec = connections[i].PacketsPerSec(); 134 | 135 | if(packets_per_sec >= MAX_PACKETS_PER_SECOND) 136 | { 137 | Kick(connections[i].guid, "Maximum packets exceeded!"); 138 | } 139 | } 140 | } 141 | 142 | 143 | private void ProcessPacket(ulong guid, ArraySegment data) 144 | { 145 | bool default_id = data.Array[0] < 134; 146 | if (default_id) 147 | { 148 | switch ((RakNetPacketID)data.Array[0]) 149 | { 150 | case RakNetPacketID.NEW_INCOMING_CONNECTION: 151 | connections.Add(new ConnectionInfo(guid, server_peer.GetAddress(guid))); 152 | OnConnected(guid); 153 | break; 154 | 155 | case RakNetPacketID.DISCONNECTION_NOTIFICATION: 156 | RemoveConnectionByGUID(guid, out ConnectionInfo guid1); 157 | OnDisconnected(guid1.guid, DisconnectionType.ConnectionClosed); 158 | break; 159 | 160 | case RakNetPacketID.CONNECTION_LOST: 161 | RemoveConnectionByGUID(guid, out ConnectionInfo guid2); 162 | OnDisconnected(guid2.guid, DisconnectionType.Timeout); 163 | break; 164 | } 165 | } 166 | else 167 | { 168 | if (GetConnectionByGUID(guid, out int i, out ConnectionInfo connection)) 169 | { 170 | OnReceivedData(connection.guid, data); 171 | connection.packets_received++; 172 | } 173 | } 174 | } 175 | 176 | public bool GetConnectionByGUID(ulong guid, out int index, out ConnectionInfo connection) 177 | { 178 | connection = null; 179 | index = -1; 180 | for (int i = 0; i < connections.Count; i++) 181 | { 182 | if (guid == connections[i].guid) 183 | { 184 | index = i; 185 | connection = connections[i]; 186 | return true; 187 | } 188 | } 189 | return false; 190 | } 191 | 192 | private void RemoveConnectionByGUID(ulong guid, out ConnectionInfo connection) 193 | { 194 | if (GetConnectionByGUID(guid, out int i, out connection)) 195 | { 196 | connections.RemoveAt(i); 197 | } 198 | } 199 | 200 | /// 201 | /// Send data to client (with packet_id && payload) 202 | /// 203 | public void SendData 204 | ( 205 | byte packet_id, 206 | byte[] data, 207 | ulong guid = 0, 208 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 209 | PacketReliability reliability = PacketReliability.RELIABLE, 210 | NetChannel channel = NetChannel.NET_EVENTS 211 | ) 212 | { 213 | server_peer?.BeginWrite(packet_id); 214 | server_peer?.WriteBytes(data); 215 | if (guid != 0) 216 | { 217 | server_peer?.SendToClient(guid, priority, reliability, channel); 218 | } 219 | } 220 | 221 | /// 222 | /// Send rpc to client 223 | /// 224 | public void SendRPC 225 | ( 226 | byte packet_id, 227 | ulong guid, 228 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 229 | PacketReliability reliability = PacketReliability.RELIABLE, 230 | NetChannel channel = NetChannel.NET_EVENTS 231 | ) 232 | { 233 | server_peer?.BeginWrite(); 234 | server_peer?.Write(packet_id); 235 | server_peer?.SendToClient(guid, priority, reliability, channel); 236 | } 237 | 238 | /// 239 | /// Send rpc to client 240 | /// 241 | public void SendRPC 242 | ( 243 | byte packet_id, 244 | ulong guid, 245 | byte data1, 246 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 247 | PacketReliability reliability = PacketReliability.RELIABLE, 248 | NetChannel channel = NetChannel.NET_EVENTS 249 | ) 250 | { 251 | server_peer?.BeginWrite(); 252 | server_peer?.Write(packet_id); 253 | server_peer?.Write(data1); 254 | server_peer?.SendToClient(guid, priority, reliability, channel); 255 | } 256 | 257 | /// 258 | /// Send rpc to client 259 | /// 260 | public void SendRPC 261 | ( 262 | byte packet_id, 263 | ulong guid, 264 | short data1, 265 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 266 | PacketReliability reliability = PacketReliability.RELIABLE, 267 | NetChannel channel = NetChannel.NET_EVENTS 268 | ) 269 | { 270 | server_peer?.BeginWrite(); 271 | server_peer?.Write(packet_id); 272 | server_peer?.Write(data1); 273 | server_peer?.SendToClient(guid, priority, reliability, channel); 274 | } 275 | 276 | /// 277 | /// Send rpc to client 278 | /// 279 | public void SendRPC 280 | ( 281 | byte packet_id, 282 | ulong guid, 283 | short data1, 284 | float data2, 285 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 286 | PacketReliability reliability = PacketReliability.RELIABLE, 287 | NetChannel channel = NetChannel.NET_EVENTS 288 | ) 289 | { 290 | server_peer?.BeginWrite(); 291 | server_peer?.Write(packet_id); 292 | server_peer?.Write(data1); 293 | server_peer?.Write(data2); 294 | server_peer?.SendToClient(guid, priority, reliability, channel); 295 | } 296 | 297 | /// 298 | /// Send rpc to client 299 | /// 300 | public void SendRPC 301 | ( 302 | byte packet_id, 303 | ulong guid, 304 | uint data1, 305 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 306 | PacketReliability reliability = PacketReliability.RELIABLE, 307 | NetChannel channel = NetChannel.NET_EVENTS 308 | ) 309 | { 310 | server_peer?.BeginWrite(); 311 | server_peer?.Write(packet_id); 312 | server_peer?.Write(data1); 313 | server_peer?.SendToClient(guid, priority, reliability, channel); 314 | } 315 | 316 | /// 317 | /// Send rpc to client 318 | /// 319 | public void SendRPC 320 | ( 321 | byte packet_id, 322 | ulong guid, 323 | short data1, 324 | byte data2, 325 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 326 | PacketReliability reliability = PacketReliability.RELIABLE, 327 | NetChannel channel = NetChannel.NET_EVENTS 328 | ) 329 | { 330 | server_peer?.BeginWrite(); 331 | server_peer?.Write(packet_id); 332 | server_peer?.Write(data1); 333 | server_peer?.Write(data2); 334 | server_peer?.SendToClient(guid, priority, reliability, channel); 335 | } 336 | 337 | /// 338 | /// Send rpc to client 339 | /// 340 | public void SendRPC 341 | ( 342 | byte packet_id, 343 | ulong guid, 344 | uint data1, 345 | byte data2, 346 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 347 | PacketReliability reliability = PacketReliability.RELIABLE, 348 | NetChannel channel = NetChannel.NET_EVENTS 349 | ) 350 | { 351 | server_peer?.BeginWrite(); 352 | server_peer?.Write(packet_id); 353 | server_peer?.Write(data1); 354 | server_peer?.Write(data2); 355 | server_peer?.SendToClient(guid, priority, reliability, channel); 356 | } 357 | 358 | 359 | /// 360 | /// Send RPC to all clients 361 | /// 362 | public void SendRPCToAll 363 | ( 364 | byte packet_id, 365 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 366 | PacketReliability reliability = PacketReliability.RELIABLE, 367 | NetChannel channel = NetChannel.NET_EVENTS 368 | ) 369 | { 370 | 371 | for (int i = 0; i < connections.Count; i++) 372 | { 373 | server_peer?.BeginWrite(); 374 | server_peer?.Write(packet_id); 375 | server_peer?.SendToClient(connections[i].guid, priority, reliability, channel); 376 | } 377 | } 378 | 379 | /// 380 | /// Send RPC to all clients 381 | /// 382 | public void SendRPCToAll 383 | ( 384 | byte packet_id, 385 | short data1, 386 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 387 | PacketReliability reliability = PacketReliability.RELIABLE, 388 | NetChannel channel = NetChannel.NET_EVENTS 389 | ) 390 | { 391 | 392 | for (int i = 0; i < connections.Count; i++) 393 | { 394 | server_peer?.BeginWrite(); 395 | server_peer?.Write(packet_id); 396 | server_peer?.Write(data1); 397 | server_peer?.SendToClient(connections[i].guid, priority, reliability, channel); 398 | } 399 | } 400 | 401 | /// 402 | /// Send data to client (with payload) 403 | /// 404 | public void SendData 405 | ( 406 | byte[] data, 407 | ulong guid = 0, 408 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 409 | PacketReliability reliability = PacketReliability.RELIABLE, 410 | NetChannel channel = NetChannel.NET_EVENTS 411 | ) 412 | { 413 | server_peer?.BeginWrite(); 414 | server_peer?.WriteBytes(data); 415 | if (guid != 0) 416 | { 417 | server_peer?.SendToClient(guid, priority, reliability, channel); 418 | } 419 | } 420 | 421 | /// 422 | /// Send data to all clients (with payload) 423 | /// 424 | public void SendDataToAll 425 | ( 426 | byte[] data, 427 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 428 | PacketReliability reliability = PacketReliability.RELIABLE, 429 | NetChannel channel = NetChannel.NET_EVENTS 430 | ) 431 | { 432 | if (server_peer.state != PeerState.RunAsServer) 433 | return; 434 | 435 | for (int i = 0; i < connections.Count; i++) 436 | { 437 | server_peer?.BeginWrite(); 438 | server_peer?.WriteBytes(data); 439 | server_peer?.SendToClient(connections[i].guid, priority, reliability, channel); 440 | } 441 | } 442 | 443 | /// 444 | /// Send packet to target 445 | /// 446 | public void SendPacket 447 | ( 448 | RakNet_Packet packet, 449 | ulong guid, 450 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 451 | PacketReliability reliability = PacketReliability.RELIABLE, 452 | NetChannel channel = NetChannel.NET_EVENTS 453 | ) 454 | { 455 | packet.SendToClient(guid, priority, reliability, channel); 456 | } 457 | 458 | /// 459 | /// Send packet to all from list 460 | /// 461 | public void SendPacketToAllFromListJob 462 | ( 463 | ulong[] list, 464 | RakNet_Packet packet, 465 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 466 | PacketReliability reliability = PacketReliability.RELIABLE, 467 | NetChannel channel = NetChannel.NET_EVENTS 468 | ) 469 | { 470 | if (server_peer.state != PeerState.RunAsServer) 471 | return; 472 | 473 | 474 | if (!packet.begin_write || !packet.end_write) 475 | { 476 | Debug.LogError("Can't send packet! Check Begin & End packet"); 477 | return; 478 | } 479 | 480 | _SendPacketToAllJob a = new _SendPacketToAllJob(); 481 | a.peer = (ulong)server_peer.ptr; 482 | a.p = priority; 483 | a.r = reliability; 484 | a.c = channel; 485 | a.array = new NativeArray(list, Allocator.TempJob); 486 | 487 | JobHandle jobHandle = a.Schedule(list.Length, 64); 488 | 489 | jobHandle.Complete(); 490 | 491 | a.array.Dispose(); 492 | } 493 | 494 | /// 495 | /// Send packet to all from list and ignore guid 496 | /// 497 | public void SendPacketToAllFromListJob 498 | ( 499 | ulong ignore_guid, 500 | ulong[] list, 501 | RakNet_Packet packet, 502 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 503 | PacketReliability reliability = PacketReliability.RELIABLE, 504 | NetChannel channel = NetChannel.NET_EVENTS 505 | ) 506 | { 507 | if (server_peer.state != PeerState.RunAsServer) 508 | return; 509 | 510 | 511 | if (!packet.begin_write || !packet.end_write) 512 | { 513 | Debug.LogError("Can't send packet! Check Begin & End packet"); 514 | return; 515 | } 516 | 517 | _SendPacketToAllJob a = new _SendPacketToAllJob(); 518 | a.peer = (ulong)server_peer.ptr; 519 | a.p = priority; 520 | a.r = reliability; 521 | a.c = channel; 522 | a.array = new NativeArray(list, Allocator.TempJob); 523 | 524 | JobHandle jobHandle = a.Schedule(list.Length, 64); 525 | 526 | jobHandle.Complete(); 527 | 528 | a.array.Dispose(); 529 | } 530 | 531 | /// 532 | /// Send packet to all 533 | /// 534 | public void SendPacketToAll 535 | ( 536 | RakNet_Packet packet, 537 | PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, 538 | PacketReliability reliability = PacketReliability.RELIABLE, 539 | NetChannel channel = NetChannel.NET_EVENTS 540 | ) 541 | { 542 | if (server_peer.state != PeerState.RunAsServer) 543 | return; 544 | 545 | 546 | if (!packet.begin_write || !packet.end_write) 547 | { 548 | Debug.LogError("Can't send packet! Check Begin & End packet"); 549 | return; 550 | } 551 | 552 | 553 | for (int i = 0; i < connections.Count; i++) 554 | { 555 | server_peer.SendToClient(connections[i].guid, priority, reliability, channel); 556 | } 557 | } 558 | 559 | 560 | struct _SendPacketToAllJob : IJobParallelFor 561 | { 562 | public NativeArray array; 563 | public ulong peer; 564 | public PacketPriority p; 565 | public PacketReliability r; 566 | public NetChannel c; 567 | 568 | public void Execute(int index) 569 | { 570 | if (array[index] != 0) 571 | { 572 | RakNet_Native.NETSND_Send((IntPtr)peer, array[index], (int)p, (int)r, (int)c); 573 | } 574 | } 575 | } 576 | 577 | 578 | public void Kick(ulong guid) 579 | { 580 | if (IsStarted) 581 | { 582 | server_peer?.CloseConnection(guid); 583 | } 584 | } 585 | public void Kick(ulong guid, string text) 586 | { 587 | if (IsStarted) 588 | { 589 | server_peer?.CloseConnection(guid, text); 590 | } 591 | } 592 | 593 | public string GetNetworkStats(ulong guid) 594 | { 595 | return server_peer != null ? server_peer.GetNetStatsString(guid) : "-"; 596 | } 597 | 598 | private void OnDestroy() 599 | { 600 | BehaviourManager.UnregisterBehaviour(this); 601 | server_peer?.Shutdown(); 602 | } 603 | 604 | private void OnApplicationQuit() 605 | { 606 | server_peer?.Shutdown(); 607 | } 608 | 609 | public virtual void OnInit() { } 610 | public virtual void ServerUpdate() { } 611 | public virtual void OnPreServerInit() { } 612 | public virtual void OnServerInitSuccess(string address, int port) { } 613 | public Action event_OnServerInitSuccess; 614 | public virtual void OnServerInitFailed() { } 615 | public Action event_OnServerInitFailed; 616 | public virtual void OnServerShutdown() { } 617 | public virtual void OnConnected(ulong connection) { } 618 | public virtual void OnDisconnected(ulong connection, DisconnectionType type) { } 619 | public virtual void OnReceivedData(ulong connection, ArraySegment data) { } 620 | } 621 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/BaseNetworkServer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8ad6a4c2794e12e4298d4014fd0d790a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97dc7f394367ee649836b7536a876b22 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/FixedFloat.cs: -------------------------------------------------------------------------------- 1 | public static class FixedFloat 2 | { 3 | public static float GetFloat(this ushort _short, ushort precision = 10) 4 | { 5 | return (_short / (float)precision); 6 | } 7 | 8 | public static ushort SetFloat(this float _float, ushort precision = 10) 9 | { 10 | return (ushort)(_float * precision); 11 | } 12 | 13 | public static float GetFloat(this byte _byte, ushort precision = 10) 14 | { 15 | return (_byte / (float)precision); 16 | } 17 | 18 | public static byte SetFloat(this float _float, byte precision = 10) 19 | { 20 | return (byte)(_float * precision); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/FixedFloat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c1528d93f4751d469c6d23efe4f9bf3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/UIntDecimal.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | [StructLayout(LayoutKind.Explicit)] 4 | internal struct UIntDecimal 5 | { 6 | [FieldOffset(0)] 7 | public ulong longValue1; 8 | 9 | [FieldOffset(8)] 10 | public ulong longValue2; 11 | 12 | [FieldOffset(0)] 13 | public decimal decimalValue; 14 | } -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/UIntDecimal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68c2993146bd3f046b9225245d40a3fc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/UIntDouble.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | [StructLayout(LayoutKind.Explicit)] 4 | internal struct UIntDouble 5 | { 6 | [FieldOffset(0)] 7 | public double doubleValue; 8 | 9 | [FieldOffset(0)] 10 | public ulong longValue; 11 | } -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/UIntDouble.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f88348a5162207459567dd0e4b09814 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/UIntFloat.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | [StructLayout(LayoutKind.Explicit)] 4 | internal struct UIntFloat 5 | { 6 | [FieldOffset(0)] 7 | public float floatValue; 8 | [FieldOffset(0)] 9 | public uint intValue; 10 | } -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Conversion/UIntFloat.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f825fcdd917bc2b468da55f3c4ca8b29 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f2339a7f752a7146822a6cd02ec1542 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkClientDebugEditorWindow.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | using static RakNet_Enums; 6 | 7 | public class BaseNetworkClientDebugEditorWindow : EditorWindow 8 | { 9 | [MenuItem("RakNet/Client Debug")] 10 | static void Init() 11 | { 12 | BaseNetworkClientDebugEditorWindow window = (BaseNetworkClientDebugEditorWindow)GetWindow(typeof(BaseNetworkClientDebugEditorWindow), true); 13 | window.titleContent = new GUIContent("Client Debugger"); 14 | window.Show(); 15 | } 16 | 17 | BaseNetworkClient _baseclient; 18 | 19 | private void Update() 20 | { 21 | Repaint(); 22 | } 23 | 24 | 25 | void OnGUI() 26 | { 27 | if (EditorApplication.isPlaying) 28 | { 29 | if (Selection.activeGameObject && Selection.activeGameObject.TryGetComponent(out BaseNetworkClient t)) 30 | { 31 | _baseclient = t; 32 | } 33 | 34 | if (_baseclient) 35 | { 36 | GUILayout.BeginHorizontal(); 37 | GUILayout.BeginVertical("box"); 38 | GUILayout.Label("Client information", EditorStyles.boldLabel); 39 | GUILayout.Label("Address " + _baseclient.Address, EditorStyles.boldLabel); 40 | GUILayout.Label("Port " + _baseclient.Port, EditorStyles.boldLabel); 41 | GUILayout.Space(15); 42 | GUILayout.Label("Ping (last) " + _baseclient.GetPingLast(), EditorStyles.boldLabel); 43 | GUILayout.Label("Ping (average) " + _baseclient.GetPingAverage(), EditorStyles.boldLabel); 44 | GUILayout.Label("Ping (lowest) " + _baseclient.GetPingLowest(), EditorStyles.boldLabel); 45 | GUILayout.Label("\nMinimal network stats"); 46 | 47 | float b_sent = _baseclient.GetNetStat(RNSPerSecondMetrics.ACTUAL_BYTES_SENT); 48 | float b_rcv = _baseclient.GetNetStat(RNSPerSecondMetrics.ACTUAL_BYTES_RECEIVED); 49 | 50 | if (b_sent < 1024) 51 | { 52 | GUILayout.Label("Sended " + b_sent.ToString("f0") + " bytes", EditorStyles.boldLabel); 53 | } 54 | 55 | if (b_sent > 1024 && b_sent < 1048576) 56 | { 57 | GUILayout.Label("Sended " + (b_sent / 1024).ToString("f1") + " kb", EditorStyles.boldLabel); 58 | } 59 | else if(b_sent >= 1048576) 60 | { 61 | GUILayout.Label("Sended " + ((b_sent / 1024) / 1024).ToString("f2") + " mb", EditorStyles.boldLabel); 62 | } 63 | 64 | if (b_rcv < 1024) 65 | { 66 | GUILayout.Label("Received " + b_rcv.ToString("f0") + " bytes", EditorStyles.boldLabel); 67 | } 68 | 69 | if (b_rcv > 1024 && b_rcv < 1048576) 70 | { 71 | GUILayout.Label("Received " + (b_rcv / 1024).ToString("f1") + " kb", EditorStyles.boldLabel); 72 | } 73 | else if (b_rcv >= 1048576) 74 | { 75 | GUILayout.Label("Received " + ((b_rcv / 1024) / 1024).ToString("f2") + " mb", EditorStyles.boldLabel); 76 | } 77 | GUILayout.Label("Loss: " + _baseclient.GetLoss() + "%", EditorStyles.boldLabel); 78 | GUILayout.EndVertical(); 79 | 80 | GUILayout.BeginVertical("box"); 81 | GUILayout.Label("Full Network Stats\n" + _baseclient.GetNetworkStats()); 82 | GUILayout.EndVertical(); 83 | 84 | GUILayout.EndHorizontal(); 85 | } 86 | else 87 | { 88 | EditorGUILayout.HelpBox("Pick NetworkClient component for get debug information...", MessageType.Error); 89 | } 90 | } 91 | else 92 | { 93 | EditorGUILayout.HelpBox("To get client debug information, you must run the game", MessageType.Error); 94 | } 95 | } 96 | } 97 | #endif 98 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkClientDebugEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd1dbbfcac38ad3428cf889e4c6bf289 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkClientEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | using static RakNet_Enums; 6 | [CustomEditor(typeof(BaseNetworkClient), true)] 7 | [CanEditMultipleObjects] 8 | public class BaseNetworkClientEditor : Editor 9 | { 10 | protected BaseNetworkClient _baseclient; 11 | 12 | protected void Init() 13 | { 14 | if (_baseclient == null) 15 | { 16 | _baseclient = target as BaseNetworkClient; 17 | } 18 | } 19 | 20 | private bool default_inspector = false; 21 | 22 | 23 | public override void OnInspectorGUI() 24 | { 25 | Init(); 26 | if (EditorApplication.isPlaying) 27 | { 28 | if (_baseclient.IsConnected) 29 | { 30 | EditorGUILayout.HelpBox("Connected to " + _baseclient.Address + ":" + _baseclient.Port, MessageType.Info); 31 | } 32 | else if(!_baseclient.IsConnecting) 33 | { 34 | EditorGUILayout.HelpBox("Client disconnected", MessageType.Error); 35 | } 36 | if (_baseclient.IsConnecting) 37 | { 38 | EditorGUILayout.HelpBox("Connecting to " + _baseclient.Address + ":" + _baseclient.Port, MessageType.Warning); 39 | 40 | } 41 | if (!_baseclient.IsConnected && !_baseclient.IsConnecting) 42 | { 43 | if (GUILayout.Button("Connect to 127.0.0.1")) 44 | { 45 | _baseclient.Connect(port:27015); 46 | } 47 | } 48 | else 49 | { 50 | if (GUILayout.Button(_baseclient.IsConnecting ? "Cancel" : "Disconnect")) 51 | { 52 | _baseclient.Disconnect(DisconnectionType.ByUser); 53 | } 54 | } 55 | } 56 | else 57 | { 58 | EditorGUILayout.HelpBox("To use the client, you must run the game", MessageType.Warning); 59 | } 60 | if (!default_inspector) 61 | { 62 | if (GUILayout.Button("Draw default inspector")) 63 | { 64 | default_inspector = true; 65 | } 66 | } 67 | else 68 | { 69 | if (GUILayout.Button("Hide default inspector")) 70 | { 71 | default_inspector = false; 72 | } 73 | DrawDefaultInspector(); 74 | } 75 | } 76 | } 77 | #endif -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkClientEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af9fd25ccc790004d8f517d0d644a8cc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkServerDebugEditorWindow.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | public class BaseNetworkServerDebugEditorWindow : EditorWindow 6 | { 7 | [MenuItem("RakNet/Server Debug")] 8 | static void Init() 9 | { 10 | BaseNetworkServerDebugEditorWindow window = (BaseNetworkServerDebugEditorWindow)GetWindow(typeof(BaseNetworkServerDebugEditorWindow),true); 11 | window.titleContent = new GUIContent("Server Debugger"); 12 | window.Show(); 13 | } 14 | 15 | BaseNetworkServer _baseserver; 16 | Vector2 connections_scroll = Vector2.zero; 17 | 18 | private void Update() 19 | { 20 | Repaint(); 21 | } 22 | 23 | void OnGUI() 24 | { 25 | if (EditorApplication.isPlaying) 26 | { 27 | if(Selection.activeGameObject && Selection.activeGameObject.TryGetComponent(out BaseNetworkServer t)) 28 | { 29 | _baseserver = t; 30 | } 31 | 32 | if (_baseserver) 33 | { 34 | GUILayout.BeginHorizontal(); 35 | GUILayout.BeginVertical("box"); 36 | GUILayout.Label("Server information", EditorStyles.boldLabel); 37 | GUILayout.Label("Bind address " + _baseserver.Address, EditorStyles.boldLabel); 38 | GUILayout.Label("Port " + _baseserver.Port, EditorStyles.boldLabel); 39 | GUILayout.Label("Connections " + _baseserver.connections.Count, EditorStyles.boldLabel); 40 | GUILayout.EndVertical(); 41 | 42 | GUILayout.Space(30); 43 | 44 | GUILayout.BeginVertical(); 45 | 46 | GUILayout.Label("Connections", EditorStyles.boldLabel); 47 | connections_scroll = GUILayout.BeginScrollView(connections_scroll); 48 | for(int i = 0; i < _baseserver.connections.Count; i++) 49 | { 50 | GUILayout.BeginVertical("box", GUILayout.Width(256)); 51 | GUILayout.Box("Guid: "+_baseserver.connections[i]); 52 | GUILayout.Box("IP: "+_baseserver.server_peer.GetAddress(_baseserver.connections[i].guid)); 53 | GUILayout.Box("Ping: (last="+_baseserver.server_peer.GetPingLast(_baseserver.connections[i].guid) +") (avg="+ _baseserver.server_peer.GetPingAverage(_baseserver.connections[i].guid) + ") (low="+ _baseserver.server_peer.GetPingLowest(_baseserver.connections[i].guid) + ")"); 54 | GUILayout.BeginHorizontal(); 55 | if(GUILayout.Button("Kick")) 56 | { 57 | _baseserver.Kick(_baseserver.connections[i].guid, "Kicked by editor!"); 58 | } 59 | if (GUILayout.Button("Get stats")) 60 | { 61 | EditorUtility.DisplayDialog("Network statistics for " + _baseserver.server_peer.GetAddress(_baseserver.connections[i].guid), 62 | _baseserver.GetNetworkStats(_baseserver.connections[i].guid), 63 | "Close"); 64 | } 65 | GUILayout.EndHorizontal(); 66 | GUILayout.EndVertical(); 67 | GUILayout.Space(5); 68 | } 69 | GUILayout.EndScrollView(); 70 | GUILayout.EndVertical(); 71 | 72 | GUILayout.EndHorizontal(); 73 | } 74 | else 75 | { 76 | EditorGUILayout.HelpBox("Pick NetworkServer component for get debug information...", MessageType.Error); 77 | } 78 | } 79 | else 80 | { 81 | EditorGUILayout.HelpBox("To get server debug information, you must run the game", MessageType.Error); 82 | } 83 | } 84 | } 85 | #endif -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkServerDebugEditorWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 484750278e3df704a892659d0d6ec303 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkServerEditor.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | 6 | [CustomEditor(typeof(BaseNetworkServer), true)] 7 | [CanEditMultipleObjects] 8 | public class BaseNetworkServerEditor : Editor 9 | { 10 | protected BaseNetworkServer _baseserver; 11 | 12 | protected void Init() 13 | { 14 | if (_baseserver == null) 15 | { 16 | _baseserver = target as BaseNetworkServer; 17 | } 18 | } 19 | 20 | private bool default_inspector = false; 21 | 22 | public override void OnInspectorGUI() 23 | { 24 | Init(); 25 | if (EditorApplication.isPlaying) 26 | { 27 | EditorGUILayout.HelpBox(_baseserver.IsStarted ? "Server is started ("+_baseserver.Address+":"+_baseserver.Port+")" : "Server is offline", _baseserver.IsStarted ? MessageType.Info : MessageType.Warning); 28 | 29 | if (!_baseserver.IsStarted) 30 | { 31 | if (GUILayout.Button("Start server on port 27015")) 32 | { 33 | _baseserver.StartServer(port: 27015); 34 | } 35 | } 36 | else 37 | { 38 | if (GUILayout.Button("Stop server")) 39 | { 40 | _baseserver.StopServer(); 41 | } 42 | } 43 | } 44 | else 45 | { 46 | EditorGUILayout.HelpBox("To use the server, you must run the game", MessageType.Warning); 47 | } 48 | 49 | if (!default_inspector) 50 | { 51 | if (GUILayout.Button("Draw default inspector")) 52 | { 53 | default_inspector = true; 54 | } 55 | } 56 | else 57 | { 58 | if (GUILayout.Button("Hide default inspector")) 59 | { 60 | default_inspector = false; 61 | } 62 | DrawDefaultInspector(); 63 | } 64 | } 65 | } 66 | #endif -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/BaseNetworkServerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9dd9e46de60450e4e9ac222a7cb0ecd6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/StopGameOnRecompiling.cs: -------------------------------------------------------------------------------- 1 | using UnityEditor; 2 | using UnityEngine; 3 | //Subscribe! My Youtube channel https://www.youtube.com/channel/UCPQ04Xpbbw2uGc1gsZtO3HQ 4 | 5 | //ATTENTION! WRITTEN EVERYTHING FOR MYSELF! IF YOU DO NOT LIKE THE IMPLEMENTATION YOU CAN WRITE YOUR OWN 6 | 7 | [InitializeOnLoad] 8 | public class StopGameOnRecompile 9 | { 10 | static StopGameOnRecompile() 11 | { 12 | EditorApplication.update += Update; 13 | } 14 | 15 | static void Update() 16 | { 17 | if (EditorApplication.isCompiling) 18 | { 19 | if (EditorApplication.isPlaying) 20 | { 21 | Debug.LogWarning("[Editor] Stopping game! Compiling code..."); 22 | EditorApplication.isPlaying = false; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/Editor/StopGameOnRecompiling.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19e2ac69b334e1e4283c2f2fc97a3648 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/QueryProtocol.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9af67ba14ed707f4ca5a40a1dc56a50c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/QueryProtocol/QueryInfo.cs: -------------------------------------------------------------------------------- 1 | [System.Serializable] 2 | public class QueryInfo 3 | { 4 | public string hostname = string.Empty; 5 | public byte players = 0; 6 | public byte maxPlayers = 0; 7 | public string scene = string.Empty; 8 | public string version = string.Empty; 9 | public short ping = 0; 10 | public QueryInfo() { } 11 | 12 | public QueryInfo(string hostname,byte players,byte maxPlayers,string scene,string version,short ping) 13 | { 14 | this.hostname = hostname; 15 | this.players = players; 16 | this.maxPlayers = maxPlayers; 17 | this.scene = scene; 18 | this.version = version; 19 | this.ping = ping; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/QueryProtocol/QueryInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 113b61b9ac9dfb7458fea8d12906feb8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/QueryProtocol/QueryProtocol.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Net; 4 | using System.Net.Sockets; 5 | using System.Threading; 6 | using UnityEngine; 7 | 8 | public enum QueryProtocolMode 9 | { 10 | Client, 11 | Server, 12 | Unknown 13 | } 14 | 15 | [Serializable] 16 | public class QueryProtocol 17 | { 18 | public static bool QueryDebug = false; 19 | public QueryProtocolMode mode = QueryProtocolMode.Unknown; 20 | public QueryProtocol(QueryProtocolMode mode) 21 | { 22 | this.mode = mode; 23 | } 24 | 25 | public bool Initialized { get; private set; } = false; 26 | 27 | public void Initialize() 28 | { 29 | Initialize(-1); 30 | } 31 | 32 | public void Initialize(int port) 33 | { 34 | if (!Initialized) 35 | { 36 | if (mode == QueryProtocolMode.Client) 37 | { 38 | udp = new UdpClient(); 39 | if (QueryDebug) 40 | { 41 | Debug.Log("[Query] Initialized..."); 42 | } 43 | Initialized = true; 44 | thread = new Thread(Loop); 45 | thread.IsBackground = true; 46 | thread.Start(); 47 | } 48 | else if (mode == QueryProtocolMode.Server) 49 | { 50 | if (port != -1) 51 | { 52 | udp = new UdpClient(port); 53 | if (QueryDebug) 54 | { 55 | Debug.Log("[Query] Initialized on port "+port); 56 | } 57 | } 58 | else 59 | { 60 | udp = new UdpClient(27020); 61 | if (QueryDebug) 62 | { 63 | Debug.Log("[Query] Initialized on port 27020"); 64 | } 65 | } 66 | Initialized = true; 67 | thread = new Thread(Loop); 68 | thread.IsBackground = true; 69 | thread.Start(); 70 | } 71 | } 72 | } 73 | private Thread thread = null; 74 | private UdpClient udp = null; 75 | private bool requested = true; 76 | private bool _request_event = false; 77 | public Action OnReceivedQuery; 78 | public Action OnQueringFailed; 79 | private float _query_timer = 0; 80 | public QueryInfo info { get; private set; } = new QueryInfo(); 81 | float time_at_last_request = 0; 82 | /// 83 | /// Requesting query from address:port 84 | /// 85 | public void RequestQuery(string address, int port) 86 | { 87 | if (mode == QueryProtocolMode.Client) 88 | { 89 | try 90 | { 91 | if (udp != null) 92 | { 93 | byte[] data = new byte[13] { 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6F, 0x74, 0x6F, 0x63, 0x6F, 0x6C };//-QueryProtocol 94 | udp.Send(data, data.Length, address, port); 95 | time_at_last_request = Time.realtimeSinceStartup; 96 | if (QueryDebug) 97 | { 98 | Debug.Log("[Query] Querying server information from "+address+":"+port); 99 | } 100 | _query_timer = 5; 101 | requested = false; 102 | } 103 | } 104 | catch { } 105 | } 106 | else 107 | { 108 | Debug.LogWarning("[Query] Requesting query available only on client"); 109 | } 110 | } 111 | 112 | private void SendQuery(IPEndPoint point) 113 | { 114 | if (mode == QueryProtocolMode.Server) 115 | { 116 | try 117 | { 118 | if (udp != null) 119 | { 120 | using (BinaryWriter writer = new BinaryWriter(new MemoryStream())) 121 | { 122 | writer.Write(new byte[13] { 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6F, 0x74, 0x6F, 0x63, 0x6F, 0x6C }); 123 | writer.Write(info.hostname); 124 | writer.Write(info.players); 125 | writer.Write(info.maxPlayers); 126 | writer.Write(info.scene); 127 | writer.Write(info.version); 128 | byte[] data = (writer.BaseStream as MemoryStream).ToArray(); 129 | udp.Send(data, data.Length, point); 130 | if (QueryDebug) 131 | { 132 | Debug.Log("[Query] Sending server information to " + point.Address + ":" + point.Port+ " [sz=" + data.Length + "]"); 133 | } 134 | } 135 | } 136 | } 137 | catch { } 138 | } 139 | else 140 | { 141 | Debug.LogWarning("[Query] Requesting query available only on server"); 142 | } 143 | } 144 | 145 | public void Update() 146 | { 147 | if(_query_timer <= 0) 148 | { 149 | _query_timer = 0; 150 | if (!requested) 151 | { 152 | OnQueringFailed?.Invoke(); 153 | } 154 | } 155 | else if(_query_timer > 0) 156 | { 157 | _query_timer -= Time.deltaTime; 158 | } 159 | 160 | if (_request_event) 161 | { 162 | info.ping = (short)((Time.realtimeSinceStartup - time_at_last_request)*1000); 163 | OnReceivedQuery?.Invoke(info); 164 | _request_event = false; 165 | } 166 | } 167 | 168 | public void Loop() 169 | { 170 | while (Initialized) 171 | { 172 | 173 | if (mode == QueryProtocolMode.Client && udp != null) 174 | { 175 | IPEndPoint remote = null; 176 | 177 | try 178 | { 179 | byte[] data = udp.Receive(ref remote); 180 | 181 | if (data.Length > 0 && 182 | data[0] == 0x51 && 183 | data[1] == 0x75 && 184 | data[2] == 0x65 && 185 | data[3] == 0x72 && 186 | data[4] == 0x79 && 187 | data[5] == 0x50 && 188 | data[6] == 0x72 && 189 | data[7] == 0x6F && 190 | data[8] == 0x74 && 191 | data[9] == 0x6f && 192 | data[10] == 0x63 && 193 | data[11] == 0x6f && 194 | data[12] == 0x6c 195 | ) 196 | { 197 | using (BinaryReader _ = new BinaryReader(new MemoryStream(data))) 198 | { 199 | _.BaseStream.Position = 13;//skip 13 bytes (skip header) 200 | info = new QueryInfo(_.ReadString(), _.ReadByte(), _.ReadByte(),_.ReadString(), _.ReadString(),0); 201 | if (QueryDebug) 202 | { 203 | Debug.Log("[Query] Received information from the requested server..."); 204 | } 205 | _request_event = true; 206 | requested = true; 207 | } 208 | } 209 | } 210 | catch { } 211 | } 212 | else if (mode == QueryProtocolMode.Server && udp != null) 213 | { 214 | IPEndPoint received_from = null; 215 | 216 | try 217 | { 218 | byte[] received_data = udp.Receive(ref received_from); 219 | //0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6F, 0x74, 0x6F, 0x63, 0x6F, 0x6C - Query Protocol 220 | //ignore data if size > 13 bytes 221 | if (received_data.Length > 0 && received_data.Length <= 13 && 222 | received_data[0] == 0x51 && 223 | received_data[1] == 0x75 && 224 | received_data[2] == 0x65 && 225 | received_data[3] == 0x72 && 226 | received_data[4] == 0x79 && 227 | received_data[5] == 0x50 && 228 | received_data[6] == 0x72 && 229 | received_data[7] == 0x6F && 230 | received_data[8] == 0x74 && 231 | received_data[9] == 0x6f && 232 | received_data[10] == 0x63 && 233 | received_data[11] == 0x6f && 234 | received_data[12] == 0x6c 235 | ) 236 | { 237 | if (QueryDebug) 238 | { 239 | Debug.Log("[Query] Request data from " + received_from.Address + ":" + received_from.Port); 240 | } 241 | SendQuery(received_from); 242 | } 243 | } 244 | catch { } 245 | } 246 | Thread.Sleep(5); 247 | } 248 | } 249 | 250 | public void Shutdown() 251 | { 252 | Initialized = false; 253 | udp?.Close(); 254 | thread?.Join(); 255 | thread?.Abort(); 256 | } 257 | } 258 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/QueryProtocol/QueryProtocol.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a3fefee41bca4e41944af2096ccf007 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/RakNet_Enums.cs: -------------------------------------------------------------------------------- 1 |  2 | public class RakNet_Enums 3 | { 4 | //Packet priority 5 | public enum PacketPriority 6 | { 7 | IMMEDIATE_PRIORITY, 8 | HIGH_PRIORITY, 9 | MEDIUM_PRIORITY, 10 | LOW_PRIORITY 11 | } 12 | 13 | //Packet reliability 14 | public enum PacketReliability 15 | { 16 | //Unreliable packets are sent by straight UDP. They may arrive out of order, or not at all. This is best for data that is unimportant, or data that you send very frequently so even if some packets are missed newer packets will compensate. 17 | UNRELIABLE = 0, 18 | //Unreliable sequenced packets are the same as unreliable packets, except that only the newest packet is ever accepted. Older packets are ignored. 19 | UNRELIABLE_SEQUENCED = 1, 20 | //Reliable ordered packets are UDP packets monitored by a reliability layer to ensure they arrive at the destination and are ordered at the destination. 21 | RELIABLE_UNORDERED = 2, 22 | //Reliable packets are UDP packets monitored by a reliablilty layer to ensure they arrive at the destination. 23 | RELIABLE = 3, 24 | //Reliable sequenced packets are UDP packets monitored by a reliability layer to ensure they arrive at the destination and are sequenced at the destination. 25 | RELIABLE_SEQUENCED = 4 26 | } 27 | 28 | public enum RNSPerSecondMetrics 29 | { 30 | /// How many bytes per pushed via a call to send 31 | USER_MESSAGE_BYTES_PUSHED, 32 | 33 | /// How many user message bytes were sent via a call to send. This is less than or equal to USER_MESSAGE_BYTES_PUSHED. 34 | /// A message would be pushed, but not yet sent, due to congestion control 35 | USER_MESSAGE_BYTES_SENT, 36 | 37 | /// How many user message bytes were resent. A message is resent if it is marked as reliable, and either the message didn't arrive or the message ack didn't arrive. 38 | USER_MESSAGE_BYTES_RESENT, 39 | 40 | /// How many user message bytes were received, and returned to the user successfully. 41 | USER_MESSAGE_BYTES_RECEIVED_PROCESSED, 42 | 43 | /// How many user message bytes were received, but ignored due to data format errors. This will usually be 0. 44 | USER_MESSAGE_BYTES_RECEIVED_IGNORED, 45 | 46 | /// How many actual bytes were sent, including per-message and per-datagram overhead, and reliable message acks 47 | ACTUAL_BYTES_SENT, 48 | 49 | /// How many actual bytes were received, including overead and acks. 50 | ACTUAL_BYTES_RECEIVED, 51 | RNS_PER_SECOND_METRICS_COUNT 52 | } 53 | 54 | //net channel 55 | public enum NetChannel 56 | { 57 | LOCALPLAYER, 58 | PLAYERS_ENTITIES, 59 | PLAYER_EVENTS, 60 | OTHER_ENTITIES, 61 | NET_EVENTS, 62 | GAME_EVENTS, 63 | CHAT, 64 | RPC, 65 | OTHER 66 | } 67 | 68 | //Disconnection type 69 | public enum DisconnectionType 70 | { 71 | ConnectionLost, 72 | ConnectionClosed, 73 | Timeout, 74 | ServerIsFull, 75 | ByUser, 76 | Unknown 77 | } 78 | 79 | public enum RakDebugLevel 80 | { 81 | None, 82 | Low, 83 | Medium, 84 | Full 85 | } 86 | 87 | public enum PeerState 88 | { 89 | Unknown, 90 | RunAsServer, 91 | RunAsClient, 92 | ClientInitFailed, 93 | ServerInitFailed 94 | } 95 | 96 | //standart native packet ids 97 | public enum RakNetPacketID 98 | { 99 | NEW_INCOMING_CONNECTION = 19, 100 | CONNECTION_REQUEST_ACCEPTED = 16, 101 | CONNECTION_ATTEMPT_FAILED = 17, 102 | NO_FREE_INCOMING_CONNECTIONS = 20, 103 | DISCONNECTION_NOTIFICATION = 21, 104 | CONNECTION_LOST = 22 105 | } 106 | } -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/RakNet_Enums.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a83153f677d3bfb4882bd8f30cfeeb35 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/RakNet_Native.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0cf5dfd7f3793fd469ba5e2c62cc72da 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/RakNet_Packet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using static RakNet_Enums; 4 | 5 | public class RakNet_Packet 6 | { 7 | /// 8 | /// Packet id 9 | /// 10 | public byte packet_id 11 | { 12 | get { return _packet_id; } 13 | private set { _packet_id = value; } 14 | } 15 | 16 | [SerializeField] 17 | private byte _packet_id; 18 | 19 | private RakNet_Peer peer; 20 | 21 | private bool _receiving; 22 | private bool _sending; 23 | 24 | public RakNet_Packet Unpack(RakNet_Peer peer, ArraySegment data) 25 | { 26 | this.peer = peer; 27 | packet_id = data.Array[0]; 28 | _sz = peer.incomingBytes - 1;//-1 skip packet id sz 29 | _receiving = true; 30 | _sending = false; 31 | try 32 | { 33 | OnDeserialize(); 34 | } 35 | catch (Exception ex) 36 | { 37 | throw new Exception(GetType().Name + " packet deserialize error! (" + ex.ToString() + ")"); 38 | } 39 | return this; 40 | } 41 | 42 | /// 43 | /// Create empty packet with packet id 44 | /// 45 | /// 46 | public void CreatePacket(RakNet_Peer peer, byte packet_id) 47 | { 48 | this.peer = peer; 49 | this.packet_id = packet_id; 50 | this._sz = 0; 51 | _receiving = false; 52 | _sending = true; 53 | OnCreatePacket(); 54 | } 55 | 56 | public override string ToString() 57 | { 58 | return "Packet class = " + GetType() + " packet = " + packet_id + " packet_size = " + Size(); 59 | } 60 | 61 | 62 | private int _sz = 0; 63 | 64 | /// 65 | /// Total size (in bytes) 66 | /// 67 | public int Size() 68 | { 69 | return _sz; 70 | } 71 | 72 | /// 73 | /// Total size (in bits) 74 | /// 75 | /// 76 | public int Bits() 77 | { 78 | return _sz * 8; 79 | } 80 | 81 | protected virtual void OnCreatePacket() { } 82 | 83 | /// 84 | /// Called on packet ready for reading data 85 | /// 86 | protected virtual void OnDeserialize() { } 87 | 88 | /// 89 | /// Called on packet end writing 90 | /// 91 | protected virtual void OnSerialize() { } 92 | 93 | /// 94 | /// Call before start write data in this packet 95 | /// 96 | public bool begin_write { get; private set; } = false; 97 | public void BeginWritePacket() 98 | { 99 | if (_receiving) 100 | { 101 | Debug.LogWarning(GetType()+ " unable to write packet! He is received!"); 102 | return; 103 | } 104 | begin_write = true; 105 | peer?.BeginWrite(); 106 | Write(packet_id); 107 | } 108 | 109 | /// 110 | /// Call after end write data in this packet 111 | /// 112 | public bool end_write { get; private set; } = false; 113 | public void EndWritePacket() 114 | { 115 | if (_receiving) 116 | { 117 | Debug.Log(GetType() + " unable to write packet! He is received!"); 118 | return; 119 | } 120 | end_write = true; 121 | OnSerialize(); 122 | } 123 | 124 | protected bool ReadBool() 125 | { 126 | if (_sending) 127 | { 128 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 129 | return false; 130 | } 131 | return peer != null ? peer.ReadBool() : false; 132 | } 133 | 134 | protected void Write(bool s) 135 | { 136 | if (_receiving) 137 | { 138 | Debug.Log(GetType() + " unable to write packet! He is received!"); 139 | return; 140 | } 141 | peer?.Write(s); 142 | _sz += 1; 143 | } 144 | 145 | protected string ReadString() 146 | { 147 | if (_sending) 148 | { 149 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 150 | return string.Empty; 151 | } 152 | return peer?.ReadString(); 153 | } 154 | protected void Write(string s) 155 | { 156 | if (_receiving) 157 | { 158 | Debug.Log(GetType() + " unable to write packet! He is received!"); 159 | return; 160 | } 161 | peer?.Write(s); 162 | _sz += s.Length * 2;//*2 - unicode 163 | } 164 | 165 | protected byte ReadByte() 166 | { 167 | if (_sending) 168 | { 169 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 170 | return byte.MinValue; 171 | } 172 | return peer != null ? peer.ReadByte() : byte.MinValue; 173 | } 174 | protected void Write(byte s) 175 | { 176 | if (_receiving) 177 | { 178 | Debug.Log(GetType() + " unable to write packet! He is received!"); 179 | return; 180 | } 181 | peer?.Write(s); 182 | _sz += 1; 183 | } 184 | 185 | protected byte[] ReadBytes() 186 | { 187 | byte[] array = new byte[1]; 188 | 189 | if (_sending) 190 | { 191 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 192 | return array; 193 | } 194 | 195 | if (peer != null) 196 | { 197 | int array_sz = peer.ReadInt(); 198 | array = new byte[array_sz]; 199 | for(int i = 0; i < array_sz; i++) 200 | { 201 | array[i] = ReadByte(); 202 | } 203 | } 204 | 205 | return array; 206 | } 207 | protected void Write(byte[] s) 208 | { 209 | if (_receiving) 210 | { 211 | Debug.Log(GetType() + " unable to write packet! He is received!"); 212 | return; 213 | } 214 | peer?.Write(s.Length); 215 | 216 | for (int i = 0; i < s.Length; i++) 217 | { 218 | peer?.Write(s[i]); 219 | } 220 | _sz += s.Length; 221 | } 222 | 223 | protected sbyte ReadSByte() 224 | { 225 | if (_sending) 226 | { 227 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 228 | return 0; 229 | } 230 | if (peer != null) 231 | { 232 | return ReadSByte(); 233 | } 234 | return 0; 235 | } 236 | 237 | protected void Write(sbyte s) 238 | { 239 | if (_receiving) 240 | { 241 | Debug.Log(GetType() + " unable to write packet! He is received!"); 242 | return; 243 | } 244 | peer?.Write(s); 245 | _sz += 1; 246 | } 247 | 248 | protected float ReadFloat() 249 | { 250 | if (_sending) 251 | { 252 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 253 | return 0; 254 | } 255 | if (peer != null) 256 | { 257 | return peer.ReadFloat(); 258 | } 259 | return 0; 260 | } 261 | 262 | protected void Write(float s) 263 | { 264 | if (_receiving) 265 | { 266 | Debug.Log(GetType() + " unable to write packet! He is received!"); 267 | return; 268 | } 269 | peer?.Write(s); 270 | _sz += 4; 271 | } 272 | 273 | protected short ReadShort() 274 | { 275 | if (_sending) 276 | { 277 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 278 | return 0; 279 | } 280 | if (peer != null) 281 | { 282 | return peer.ReadShort(); 283 | } 284 | return 0; 285 | } 286 | protected void Write(short s) 287 | { 288 | if (_receiving) 289 | { 290 | Debug.Log(GetType() + " unable to write packet! He is received!"); 291 | return; 292 | } 293 | peer?.Write(s); 294 | _sz += 2; 295 | } 296 | 297 | protected ushort ReadUShort() 298 | { 299 | if (_sending) 300 | { 301 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 302 | return 0; 303 | } 304 | if (peer != null) 305 | { 306 | return peer.ReadUShort(); 307 | } 308 | return 0; 309 | } 310 | protected void Write(ushort s) 311 | { 312 | if (_receiving) 313 | { 314 | Debug.Log(GetType() + " unable to write packet! He is received!"); 315 | return; 316 | } 317 | peer?.Write(s); 318 | _sz += 2; 319 | } 320 | 321 | protected int ReadInt() 322 | { 323 | if (_sending) 324 | { 325 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 326 | return 0; 327 | } 328 | if (peer != null) 329 | { 330 | return peer.ReadInt(); 331 | } 332 | return 0; 333 | } 334 | protected void Write(int s) 335 | { 336 | if (_receiving) 337 | { 338 | Debug.Log(GetType() + " unable to write packet! He is received!"); 339 | return; 340 | } 341 | peer?.Write(s); 342 | _sz += 4; 343 | } 344 | 345 | protected uint ReadUInt() 346 | { 347 | if (_sending) 348 | { 349 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 350 | return 0; 351 | } 352 | if (peer != null) 353 | { 354 | return peer.ReadUInt(); 355 | } 356 | return 0; 357 | } 358 | protected void Write(uint s) 359 | { 360 | if (_receiving) 361 | { 362 | Debug.Log(GetType() + " unable to write packet! He is received!"); 363 | return; 364 | } 365 | peer?.Write(s); 366 | _sz += 4; 367 | } 368 | 369 | protected long ReadLong() 370 | { 371 | if (_sending) 372 | { 373 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 374 | return 0; 375 | } 376 | if (peer != null) 377 | { 378 | return peer.ReadLong(); 379 | } 380 | return 0; 381 | } 382 | protected void Write(long s) 383 | { 384 | if (_receiving) 385 | { 386 | Debug.Log(GetType() + " unable to write packet! He is received!"); 387 | return; 388 | } 389 | peer?.Write(s); 390 | _sz += 8; 391 | } 392 | 393 | protected ulong ReadULong() 394 | { 395 | if (_sending) 396 | { 397 | Debug.Log(GetType() + " unable to read data in packet! It is sent!"); 398 | return 0; 399 | } 400 | if (peer != null) 401 | { 402 | return peer.ReadULong(); 403 | } 404 | return 0; 405 | } 406 | protected void Write(ulong s) 407 | { 408 | if (_receiving) 409 | { 410 | Debug.Log(GetType() + " unable to write packet! He is received!"); 411 | return; 412 | } 413 | peer?.Write(s); 414 | _sz += 8; 415 | } 416 | 417 | protected Color ReadColor() 418 | { 419 | if (peer != null) 420 | { 421 | return new Color(ReadFloat(), ReadFloat(), ReadFloat(), ReadFloat()); 422 | } 423 | return Color.white; 424 | } 425 | protected void Write(Color s) 426 | { 427 | Write(s.r); 428 | Write(s.g); 429 | Write(s.b); 430 | Write(s.a); 431 | } 432 | 433 | protected Vector2 ReadVector2() 434 | { 435 | if (peer != null) 436 | { 437 | return new Vector2(ReadFloat(), ReadFloat()); 438 | } 439 | return Vector2.zero; 440 | } 441 | protected void Write(Vector2 s) 442 | { 443 | Write(s.x); 444 | Write(s.y); 445 | } 446 | 447 | protected Vector3 ReadVector3() 448 | { 449 | if (peer != null) 450 | { 451 | return new Vector3(ReadFloat(), ReadFloat(), ReadFloat()); 452 | } 453 | return Vector3.zero; 454 | } 455 | 456 | protected void Write(Vector3 s, ushort precision) 457 | { 458 | Write(s.x.SetFloat(precision)); 459 | Write(s.y.SetFloat(precision)); 460 | Write(s.z.SetFloat(precision)); 461 | } 462 | 463 | protected void Write(Vector3 s, byte precision) 464 | { 465 | Write(s.x.SetFloat(precision)); 466 | Write(s.y.SetFloat(precision)); 467 | Write(s.z.SetFloat(precision)); 468 | } 469 | 470 | protected Vector3 ReadVector3(ushort precision) 471 | { 472 | if (peer != null) 473 | { 474 | return new Vector3(ReadUShort().GetFloat(precision), ReadUShort().GetFloat(precision), ReadUShort().GetFloat(precision)); 475 | } 476 | return Vector3.zero; 477 | } 478 | 479 | protected Vector3 ReadVector3(byte precision) 480 | { 481 | if (peer != null) 482 | { 483 | return new Vector3(ReadByte().GetFloat(precision), ReadByte().GetFloat(precision), ReadByte().GetFloat(precision)); 484 | } 485 | return Vector3.zero; 486 | } 487 | 488 | protected void Write(Vector3 s) 489 | { 490 | Write(s.x); 491 | Write(s.y); 492 | Write(s.z); 493 | } 494 | 495 | protected Vector4 ReadVector4() 496 | { 497 | if (peer != null) 498 | { 499 | return new Vector4(ReadFloat(), ReadFloat(), ReadFloat(), ReadFloat()); 500 | } 501 | return Vector4.zero; 502 | } 503 | protected void Write(Vector4 s) 504 | { 505 | Write(s.x); 506 | Write(s.y); 507 | Write(s.z); 508 | Write(s.w); 509 | } 510 | 511 | protected Quaternion ReadQuaternion() 512 | { 513 | if (peer != null) 514 | { 515 | return new Quaternion(ReadFloat(), ReadFloat(), ReadFloat(), ReadFloat()); 516 | } 517 | return Quaternion.identity; 518 | } 519 | protected void Write(Quaternion s) 520 | { 521 | Write(s.x); 522 | Write(s.y); 523 | Write(s.z); 524 | Write(s.w); 525 | } 526 | 527 | public void SendToServer(PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, PacketReliability reliability = PacketReliability.RELIABLE, NetChannel channel = NetChannel.NET_EVENTS) 528 | { 529 | peer?.SendToServer(priority, reliability, channel); 530 | } 531 | 532 | public void SendToClient(ulong guid,PacketPriority priority = PacketPriority.IMMEDIATE_PRIORITY, PacketReliability reliability = PacketReliability.RELIABLE, NetChannel channel = NetChannel.NET_EVENTS) 533 | { 534 | peer?.SendToClient(guid,priority, reliability, channel); 535 | } 536 | } 537 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/RakNet_Packet.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75b3f63549b483c46b6722334688fd8a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/RakNet_Peer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 138d1fea9abf93441ae687fd0d64bdfe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/x86.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fcc33fe6d430bc43903f1090a2daaa4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/x86/RakNet_x86.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Assets/Scripts/RakNet/x86/RakNet_x86.dll -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/x86/RakNet_x86.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d2c493c74f72e440a6bbdb9d1668a35 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | userData: 26 | assetBundleName: 27 | assetBundleVariant: 28 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/x86_64.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c613365b7522be45b63bd390107a829 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/x86_64/RakNet_x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Assets/Scripts/RakNet/x86_64/RakNet_x64.dll -------------------------------------------------------------------------------- /Assets/Scripts/RakNet/x86_64/RakNet_x64.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b275f9a1b1e8de4dba74b6047f475de 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 1 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | userData: 26 | assetBundleName: 27 | assetBundleVariant: 28 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 284fd14358763124694553e93d218b65 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d5842e63074c8e48ab8848a6658b5f3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Editor/ReadmeEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using System; 6 | using System.IO; 7 | using System.Reflection; 8 | 9 | [CustomEditor(typeof(Readme))] 10 | [InitializeOnLoad] 11 | public class ReadmeEditor : Editor 12 | { 13 | 14 | static string kShowedReadmeSessionStateName = "ReadmeEditor.showedReadme"; 15 | 16 | static float kSpace = 16f; 17 | 18 | static ReadmeEditor() 19 | { 20 | EditorApplication.delayCall += SelectReadmeAutomatically; 21 | } 22 | 23 | static void SelectReadmeAutomatically() 24 | { 25 | if (!SessionState.GetBool(kShowedReadmeSessionStateName, false)) 26 | { 27 | var readme = SelectReadme(); 28 | SessionState.SetBool(kShowedReadmeSessionStateName, true); 29 | 30 | if (readme && !readme.loadedLayout) 31 | { 32 | LoadLayout(); 33 | readme.loadedLayout = true; 34 | } 35 | } 36 | } 37 | 38 | static void LoadLayout() 39 | { 40 | var assembly = typeof(EditorApplication).Assembly; 41 | var windowLayoutType = assembly.GetType("UnityEditor.WindowLayout", true); 42 | var method = windowLayoutType.GetMethod("LoadWindowLayout", BindingFlags.Public | BindingFlags.Static); 43 | method.Invoke(null, new object[] { Path.Combine(Application.dataPath, "Scripts/Readme/Layout.wlt"), false }); 44 | } 45 | 46 | [MenuItem("Readme/Show Readme")] 47 | static Readme SelectReadme() 48 | { 49 | var readmeObject = AssetDatabase.LoadMainAssetAtPath("Assets/Scripts/Readme/Readme.asset"); 50 | 51 | Selection.objects = new UnityEngine.Object[] { readmeObject }; 52 | 53 | return (Readme)readmeObject; 54 | } 55 | 56 | protected override void OnHeaderGUI() 57 | { 58 | var readme = (Readme)target; 59 | Init(); 60 | 61 | var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth / 3f - 20f, 128f); 62 | 63 | GUILayout.BeginHorizontal("In BigTitle"); 64 | { 65 | GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth)); 66 | GUILayout.Label(readme.title, TitleStyle); 67 | } 68 | GUILayout.EndHorizontal(); 69 | } 70 | 71 | public override void OnInspectorGUI() 72 | { 73 | var readme = (Readme)target; 74 | Init(); 75 | 76 | foreach (var section in readme.sections) 77 | { 78 | if (!string.IsNullOrEmpty(section.heading)) 79 | { 80 | GUILayout.Label(section.heading, HeadingStyle); 81 | } 82 | if (!string.IsNullOrEmpty(section.text)) 83 | { 84 | GUILayout.Label(section.text, BodyStyle); 85 | } 86 | if (!string.IsNullOrEmpty(section.linkText)) 87 | { 88 | if (LinkLabel(new GUIContent(section.linkText))) 89 | { 90 | Application.OpenURL(section.url); 91 | } 92 | } 93 | GUILayout.Space(kSpace); 94 | } 95 | } 96 | 97 | 98 | bool m_Initialized; 99 | 100 | GUIStyle LinkStyle { get { return m_LinkStyle; } } 101 | [SerializeField] GUIStyle m_LinkStyle; 102 | 103 | GUIStyle TitleStyle { get { return m_TitleStyle; } } 104 | [SerializeField] GUIStyle m_TitleStyle; 105 | 106 | GUIStyle HeadingStyle { get { return m_HeadingStyle; } } 107 | [SerializeField] GUIStyle m_HeadingStyle; 108 | 109 | GUIStyle BodyStyle { get { return m_BodyStyle; } } 110 | [SerializeField] GUIStyle m_BodyStyle; 111 | 112 | void Init() 113 | { 114 | if (m_Initialized) 115 | return; 116 | m_BodyStyle = new GUIStyle(EditorStyles.label); 117 | m_BodyStyle.wordWrap = true; 118 | m_BodyStyle.fontSize = 14; 119 | 120 | m_TitleStyle = new GUIStyle(m_BodyStyle); 121 | m_TitleStyle.fontSize = 26; 122 | 123 | m_HeadingStyle = new GUIStyle(m_BodyStyle); 124 | m_HeadingStyle.fontSize = 18; 125 | 126 | m_LinkStyle = new GUIStyle(m_BodyStyle); 127 | m_LinkStyle.wordWrap = false; 128 | // Match selection color which works nicely for both light and dark skins 129 | m_LinkStyle.normal.textColor = new Color(0x00 / 255f, 0x78 / 255f, 0xDA / 255f, 1f); 130 | m_LinkStyle.stretchWidth = false; 131 | 132 | m_Initialized = true; 133 | } 134 | 135 | bool LinkLabel(GUIContent label, params GUILayoutOption[] options) 136 | { 137 | var position = GUILayoutUtility.GetRect(label, LinkStyle, options); 138 | 139 | Handles.BeginGUI(); 140 | Handles.color = LinkStyle.normal.textColor; 141 | Handles.DrawLine(new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax)); 142 | Handles.color = Color.white; 143 | Handles.EndGUI(); 144 | 145 | EditorGUIUtility.AddCursorRect(position, MouseCursor.Link); 146 | 147 | return GUI.Button(position, label, LinkStyle); 148 | } 149 | } 150 | 151 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Editor/ReadmeEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 759e7cf148b631a468e10ed097947b9f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Icons.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb98ef4432fb7454da7c78c755e47ae8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Icons/Help_Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Assets/Scripts/Readme/Icons/Help_Icon.png -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Icons/Help_Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2d2464df23330d4cb2d903243d86908 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Icons/raknet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Assets/Scripts/Readme/Icons/raknet.png -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Icons/raknet.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2777d3a00b766a840a19de91c69084ba 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Layout.wlt: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 52 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_GameObject: {fileID: 0} 9 | m_Enabled: 1 10 | m_EditorHideFlags: 1 11 | m_Script: {fileID: 12004, guid: 0000000000000000e000000000000000, type: 0} 12 | m_Name: 13 | m_EditorClassIdentifier: 14 | m_PixelRect: 15 | serializedVersion: 2 16 | x: 0 17 | y: 45 18 | width: 1666 19 | height: 958 20 | m_ShowMode: 4 21 | m_Title: 22 | m_RootView: {fileID: 6} 23 | m_MinSize: {x: 950, y: 542} 24 | m_MaxSize: {x: 10000, y: 10000} 25 | --- !u!114 &2 26 | MonoBehaviour: 27 | m_ObjectHideFlags: 52 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_GameObject: {fileID: 0} 31 | m_Enabled: 1 32 | m_EditorHideFlags: 1 33 | m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} 34 | m_Name: 35 | m_EditorClassIdentifier: 36 | m_Children: [] 37 | m_Position: 38 | serializedVersion: 2 39 | x: 0 40 | y: 466 41 | width: 290 42 | height: 442 43 | m_MinSize: {x: 234, y: 271} 44 | m_MaxSize: {x: 10004, y: 10021} 45 | m_ActualView: {fileID: 14} 46 | m_Panes: 47 | - {fileID: 14} 48 | m_Selected: 0 49 | m_LastSelected: 0 50 | --- !u!114 &3 51 | MonoBehaviour: 52 | m_ObjectHideFlags: 52 53 | m_PrefabParentObject: {fileID: 0} 54 | m_PrefabInternal: {fileID: 0} 55 | m_GameObject: {fileID: 0} 56 | m_Enabled: 1 57 | m_EditorHideFlags: 1 58 | m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} 59 | m_Name: 60 | m_EditorClassIdentifier: 61 | m_Children: 62 | - {fileID: 4} 63 | - {fileID: 2} 64 | m_Position: 65 | serializedVersion: 2 66 | x: 973 67 | y: 0 68 | width: 290 69 | height: 908 70 | m_MinSize: {x: 234, y: 492} 71 | m_MaxSize: {x: 10004, y: 14042} 72 | vertical: 1 73 | controlID: 226 74 | --- !u!114 &4 75 | MonoBehaviour: 76 | m_ObjectHideFlags: 52 77 | m_PrefabParentObject: {fileID: 0} 78 | m_PrefabInternal: {fileID: 0} 79 | m_GameObject: {fileID: 0} 80 | m_Enabled: 1 81 | m_EditorHideFlags: 1 82 | m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} 83 | m_Name: 84 | m_EditorClassIdentifier: 85 | m_Children: [] 86 | m_Position: 87 | serializedVersion: 2 88 | x: 0 89 | y: 0 90 | width: 290 91 | height: 466 92 | m_MinSize: {x: 204, y: 221} 93 | m_MaxSize: {x: 4004, y: 4021} 94 | m_ActualView: {fileID: 17} 95 | m_Panes: 96 | - {fileID: 17} 97 | m_Selected: 0 98 | m_LastSelected: 0 99 | --- !u!114 &5 100 | MonoBehaviour: 101 | m_ObjectHideFlags: 52 102 | m_PrefabParentObject: {fileID: 0} 103 | m_PrefabInternal: {fileID: 0} 104 | m_GameObject: {fileID: 0} 105 | m_Enabled: 1 106 | m_EditorHideFlags: 1 107 | m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} 108 | m_Name: 109 | m_EditorClassIdentifier: 110 | m_Children: [] 111 | m_Position: 112 | serializedVersion: 2 113 | x: 0 114 | y: 466 115 | width: 973 116 | height: 442 117 | m_MinSize: {x: 202, y: 221} 118 | m_MaxSize: {x: 4002, y: 4021} 119 | m_ActualView: {fileID: 15} 120 | m_Panes: 121 | - {fileID: 15} 122 | m_Selected: 0 123 | m_LastSelected: 0 124 | --- !u!114 &6 125 | MonoBehaviour: 126 | m_ObjectHideFlags: 52 127 | m_PrefabParentObject: {fileID: 0} 128 | m_PrefabInternal: {fileID: 0} 129 | m_GameObject: {fileID: 0} 130 | m_Enabled: 1 131 | m_EditorHideFlags: 1 132 | m_Script: {fileID: 12008, guid: 0000000000000000e000000000000000, type: 0} 133 | m_Name: 134 | m_EditorClassIdentifier: 135 | m_Children: 136 | - {fileID: 7} 137 | - {fileID: 8} 138 | - {fileID: 9} 139 | m_Position: 140 | serializedVersion: 2 141 | x: 0 142 | y: 0 143 | width: 1666 144 | height: 958 145 | m_MinSize: {x: 950, y: 542} 146 | m_MaxSize: {x: 10000, y: 10000} 147 | --- !u!114 &7 148 | MonoBehaviour: 149 | m_ObjectHideFlags: 52 150 | m_PrefabParentObject: {fileID: 0} 151 | m_PrefabInternal: {fileID: 0} 152 | m_GameObject: {fileID: 0} 153 | m_Enabled: 1 154 | m_EditorHideFlags: 1 155 | m_Script: {fileID: 12011, guid: 0000000000000000e000000000000000, type: 0} 156 | m_Name: 157 | m_EditorClassIdentifier: 158 | m_Children: [] 159 | m_Position: 160 | serializedVersion: 2 161 | x: 0 162 | y: 0 163 | width: 1666 164 | height: 30 165 | m_MinSize: {x: 0, y: 0} 166 | m_MaxSize: {x: 0, y: 0} 167 | m_LastLoadedLayoutName: Tutorial 168 | --- !u!114 &8 169 | MonoBehaviour: 170 | m_ObjectHideFlags: 52 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 0} 174 | m_Enabled: 1 175 | m_EditorHideFlags: 1 176 | m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} 177 | m_Name: 178 | m_EditorClassIdentifier: 179 | m_Children: 180 | - {fileID: 10} 181 | - {fileID: 3} 182 | - {fileID: 11} 183 | m_Position: 184 | serializedVersion: 2 185 | x: 0 186 | y: 30 187 | width: 1666 188 | height: 908 189 | m_MinSize: {x: 713, y: 492} 190 | m_MaxSize: {x: 18008, y: 14042} 191 | vertical: 0 192 | controlID: 74 193 | --- !u!114 &9 194 | MonoBehaviour: 195 | m_ObjectHideFlags: 52 196 | m_PrefabParentObject: {fileID: 0} 197 | m_PrefabInternal: {fileID: 0} 198 | m_GameObject: {fileID: 0} 199 | m_Enabled: 1 200 | m_EditorHideFlags: 1 201 | m_Script: {fileID: 12042, guid: 0000000000000000e000000000000000, type: 0} 202 | m_Name: 203 | m_EditorClassIdentifier: 204 | m_Children: [] 205 | m_Position: 206 | serializedVersion: 2 207 | x: 0 208 | y: 938 209 | width: 1666 210 | height: 20 211 | m_MinSize: {x: 0, y: 0} 212 | m_MaxSize: {x: 0, y: 0} 213 | --- !u!114 &10 214 | MonoBehaviour: 215 | m_ObjectHideFlags: 52 216 | m_PrefabParentObject: {fileID: 0} 217 | m_PrefabInternal: {fileID: 0} 218 | m_GameObject: {fileID: 0} 219 | m_Enabled: 1 220 | m_EditorHideFlags: 1 221 | m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} 222 | m_Name: 223 | m_EditorClassIdentifier: 224 | m_Children: 225 | - {fileID: 12} 226 | - {fileID: 5} 227 | m_Position: 228 | serializedVersion: 2 229 | x: 0 230 | y: 0 231 | width: 973 232 | height: 908 233 | m_MinSize: {x: 202, y: 442} 234 | m_MaxSize: {x: 4002, y: 8042} 235 | vertical: 1 236 | controlID: 75 237 | --- !u!114 &11 238 | MonoBehaviour: 239 | m_ObjectHideFlags: 52 240 | m_PrefabParentObject: {fileID: 0} 241 | m_PrefabInternal: {fileID: 0} 242 | m_GameObject: {fileID: 0} 243 | m_Enabled: 1 244 | m_EditorHideFlags: 1 245 | m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} 246 | m_Name: 247 | m_EditorClassIdentifier: 248 | m_Children: [] 249 | m_Position: 250 | serializedVersion: 2 251 | x: 1263 252 | y: 0 253 | width: 403 254 | height: 908 255 | m_MinSize: {x: 277, y: 71} 256 | m_MaxSize: {x: 4002, y: 4021} 257 | m_ActualView: {fileID: 13} 258 | m_Panes: 259 | - {fileID: 13} 260 | m_Selected: 0 261 | m_LastSelected: 0 262 | --- !u!114 &12 263 | MonoBehaviour: 264 | m_ObjectHideFlags: 52 265 | m_PrefabParentObject: {fileID: 0} 266 | m_PrefabInternal: {fileID: 0} 267 | m_GameObject: {fileID: 0} 268 | m_Enabled: 1 269 | m_EditorHideFlags: 1 270 | m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} 271 | m_Name: 272 | m_EditorClassIdentifier: 273 | m_Children: [] 274 | m_Position: 275 | serializedVersion: 2 276 | x: 0 277 | y: 0 278 | width: 973 279 | height: 466 280 | m_MinSize: {x: 202, y: 221} 281 | m_MaxSize: {x: 4002, y: 4021} 282 | m_ActualView: {fileID: 16} 283 | m_Panes: 284 | - {fileID: 16} 285 | m_Selected: 0 286 | m_LastSelected: 0 287 | --- !u!114 &13 288 | MonoBehaviour: 289 | m_ObjectHideFlags: 52 290 | m_PrefabParentObject: {fileID: 0} 291 | m_PrefabInternal: {fileID: 0} 292 | m_GameObject: {fileID: 0} 293 | m_Enabled: 1 294 | m_EditorHideFlags: 1 295 | m_Script: {fileID: 12019, guid: 0000000000000000e000000000000000, type: 0} 296 | m_Name: 297 | m_EditorClassIdentifier: 298 | m_AutoRepaintOnSceneChange: 0 299 | m_MinSize: {x: 275, y: 50} 300 | m_MaxSize: {x: 4000, y: 4000} 301 | m_TitleContent: 302 | m_Text: Inspector 303 | m_Image: {fileID: -6905738622615590433, guid: 0000000000000000d000000000000000, 304 | type: 0} 305 | m_Tooltip: 306 | m_DepthBufferBits: 0 307 | m_Pos: 308 | serializedVersion: 2 309 | x: 2 310 | y: 19 311 | width: 401 312 | height: 887 313 | m_ScrollPosition: {x: 0, y: 0} 314 | m_InspectorMode: 0 315 | m_PreviewResizer: 316 | m_CachedPref: -160 317 | m_ControlHash: -371814159 318 | m_PrefName: Preview_InspectorPreview 319 | m_PreviewWindow: {fileID: 0} 320 | --- !u!114 &14 321 | MonoBehaviour: 322 | m_ObjectHideFlags: 52 323 | m_PrefabParentObject: {fileID: 0} 324 | m_PrefabInternal: {fileID: 0} 325 | m_GameObject: {fileID: 0} 326 | m_Enabled: 1 327 | m_EditorHideFlags: 1 328 | m_Script: {fileID: 12014, guid: 0000000000000000e000000000000000, type: 0} 329 | m_Name: 330 | m_EditorClassIdentifier: 331 | m_AutoRepaintOnSceneChange: 0 332 | m_MinSize: {x: 230, y: 250} 333 | m_MaxSize: {x: 10000, y: 10000} 334 | m_TitleContent: 335 | m_Text: Project 336 | m_Image: {fileID: -7501376956915960154, guid: 0000000000000000d000000000000000, 337 | type: 0} 338 | m_Tooltip: 339 | m_DepthBufferBits: 0 340 | m_Pos: 341 | serializedVersion: 2 342 | x: 2 343 | y: 19 344 | width: 286 345 | height: 421 346 | m_SearchFilter: 347 | m_NameFilter: 348 | m_ClassNames: [] 349 | m_AssetLabels: [] 350 | m_AssetBundleNames: [] 351 | m_VersionControlStates: [] 352 | m_ReferencingInstanceIDs: 353 | m_ScenePaths: [] 354 | m_ShowAllHits: 0 355 | m_SearchArea: 0 356 | m_Folders: 357 | - Assets 358 | m_ViewMode: 0 359 | m_StartGridSize: 64 360 | m_LastFolders: 361 | - Assets 362 | m_LastFoldersGridSize: -1 363 | m_LastProjectPath: /Users/danielbrauer/Unity Projects/New Unity Project 47 364 | m_IsLocked: 0 365 | m_FolderTreeState: 366 | scrollPos: {x: 0, y: 0} 367 | m_SelectedIDs: ee240000 368 | m_LastClickedID: 9454 369 | m_ExpandedIDs: ee24000000ca9a3bffffff7f 370 | m_RenameOverlay: 371 | m_UserAcceptedRename: 0 372 | m_Name: 373 | m_OriginalName: 374 | m_EditFieldRect: 375 | serializedVersion: 2 376 | x: 0 377 | y: 0 378 | width: 0 379 | height: 0 380 | m_UserData: 0 381 | m_IsWaitingForDelay: 0 382 | m_IsRenaming: 0 383 | m_OriginalEventType: 11 384 | m_IsRenamingFilename: 1 385 | m_ClientGUIView: {fileID: 0} 386 | m_SearchString: 387 | m_CreateAssetUtility: 388 | m_EndAction: {fileID: 0} 389 | m_InstanceID: 0 390 | m_Path: 391 | m_Icon: {fileID: 0} 392 | m_ResourceFile: 393 | m_AssetTreeState: 394 | scrollPos: {x: 0, y: 0} 395 | m_SelectedIDs: 68fbffff 396 | m_LastClickedID: 0 397 | m_ExpandedIDs: ee240000 398 | m_RenameOverlay: 399 | m_UserAcceptedRename: 0 400 | m_Name: 401 | m_OriginalName: 402 | m_EditFieldRect: 403 | serializedVersion: 2 404 | x: 0 405 | y: 0 406 | width: 0 407 | height: 0 408 | m_UserData: 0 409 | m_IsWaitingForDelay: 0 410 | m_IsRenaming: 0 411 | m_OriginalEventType: 11 412 | m_IsRenamingFilename: 1 413 | m_ClientGUIView: {fileID: 0} 414 | m_SearchString: 415 | m_CreateAssetUtility: 416 | m_EndAction: {fileID: 0} 417 | m_InstanceID: 0 418 | m_Path: 419 | m_Icon: {fileID: 0} 420 | m_ResourceFile: 421 | m_ListAreaState: 422 | m_SelectedInstanceIDs: 68fbffff 423 | m_LastClickedInstanceID: -1176 424 | m_HadKeyboardFocusLastEvent: 0 425 | m_ExpandedInstanceIDs: c6230000 426 | m_RenameOverlay: 427 | m_UserAcceptedRename: 0 428 | m_Name: 429 | m_OriginalName: 430 | m_EditFieldRect: 431 | serializedVersion: 2 432 | x: 0 433 | y: 0 434 | width: 0 435 | height: 0 436 | m_UserData: 0 437 | m_IsWaitingForDelay: 0 438 | m_IsRenaming: 0 439 | m_OriginalEventType: 11 440 | m_IsRenamingFilename: 1 441 | m_ClientGUIView: {fileID: 0} 442 | m_CreateAssetUtility: 443 | m_EndAction: {fileID: 0} 444 | m_InstanceID: 0 445 | m_Path: 446 | m_Icon: {fileID: 0} 447 | m_ResourceFile: 448 | m_NewAssetIndexInList: -1 449 | m_ScrollPosition: {x: 0, y: 0} 450 | m_GridSize: 64 451 | m_DirectoriesAreaWidth: 110 452 | --- !u!114 &15 453 | MonoBehaviour: 454 | m_ObjectHideFlags: 52 455 | m_PrefabParentObject: {fileID: 0} 456 | m_PrefabInternal: {fileID: 0} 457 | m_GameObject: {fileID: 0} 458 | m_Enabled: 1 459 | m_EditorHideFlags: 1 460 | m_Script: {fileID: 12015, guid: 0000000000000000e000000000000000, type: 0} 461 | m_Name: 462 | m_EditorClassIdentifier: 463 | m_AutoRepaintOnSceneChange: 1 464 | m_MinSize: {x: 200, y: 200} 465 | m_MaxSize: {x: 4000, y: 4000} 466 | m_TitleContent: 467 | m_Text: Game 468 | m_Image: {fileID: -2087823869225018852, guid: 0000000000000000d000000000000000, 469 | type: 0} 470 | m_Tooltip: 471 | m_DepthBufferBits: 32 472 | m_Pos: 473 | serializedVersion: 2 474 | x: 0 475 | y: 19 476 | width: 971 477 | height: 421 478 | m_MaximizeOnPlay: 0 479 | m_Gizmos: 0 480 | m_Stats: 0 481 | m_SelectedSizes: 00000000000000000000000000000000000000000000000000000000000000000000000000000000 482 | m_TargetDisplay: 0 483 | m_ZoomArea: 484 | m_HRangeLocked: 0 485 | m_VRangeLocked: 0 486 | m_HBaseRangeMin: -242.75 487 | m_HBaseRangeMax: 242.75 488 | m_VBaseRangeMin: -101 489 | m_VBaseRangeMax: 101 490 | m_HAllowExceedBaseRangeMin: 1 491 | m_HAllowExceedBaseRangeMax: 1 492 | m_VAllowExceedBaseRangeMin: 1 493 | m_VAllowExceedBaseRangeMax: 1 494 | m_ScaleWithWindow: 0 495 | m_HSlider: 0 496 | m_VSlider: 0 497 | m_IgnoreScrollWheelUntilClicked: 0 498 | m_EnableMouseInput: 1 499 | m_EnableSliderZoom: 0 500 | m_UniformScale: 1 501 | m_UpDirection: 1 502 | m_DrawArea: 503 | serializedVersion: 2 504 | x: 0 505 | y: 17 506 | width: 971 507 | height: 404 508 | m_Scale: {x: 2, y: 2} 509 | m_Translation: {x: 485.5, y: 202} 510 | m_MarginLeft: 0 511 | m_MarginRight: 0 512 | m_MarginTop: 0 513 | m_MarginBottom: 0 514 | m_LastShownAreaInsideMargins: 515 | serializedVersion: 2 516 | x: -242.75 517 | y: -101 518 | width: 485.5 519 | height: 202 520 | m_MinimalGUI: 1 521 | m_defaultScale: 2 522 | m_TargetTexture: {fileID: 0} 523 | m_CurrentColorSpace: 0 524 | m_LastWindowPixelSize: {x: 1942, y: 842} 525 | m_ClearInEditMode: 1 526 | m_NoCameraWarning: 1 527 | m_LowResolutionForAspectRatios: 01000000000100000100 528 | --- !u!114 &16 529 | MonoBehaviour: 530 | m_ObjectHideFlags: 52 531 | m_PrefabParentObject: {fileID: 0} 532 | m_PrefabInternal: {fileID: 0} 533 | m_GameObject: {fileID: 0} 534 | m_Enabled: 1 535 | m_EditorHideFlags: 1 536 | m_Script: {fileID: 12013, guid: 0000000000000000e000000000000000, type: 0} 537 | m_Name: 538 | m_EditorClassIdentifier: 539 | m_AutoRepaintOnSceneChange: 1 540 | m_MinSize: {x: 200, y: 200} 541 | m_MaxSize: {x: 4000, y: 4000} 542 | m_TitleContent: 543 | m_Text: Scene 544 | m_Image: {fileID: 2318424515335265636, guid: 0000000000000000d000000000000000, 545 | type: 0} 546 | m_Tooltip: 547 | m_DepthBufferBits: 32 548 | m_Pos: 549 | serializedVersion: 2 550 | x: 0 551 | y: 19 552 | width: 971 553 | height: 445 554 | m_SceneLighting: 1 555 | lastFramingTime: 0 556 | m_2DMode: 0 557 | m_isRotationLocked: 0 558 | m_AudioPlay: 0 559 | m_Position: 560 | m_Target: {x: 0, y: 0, z: 0} 561 | speed: 2 562 | m_Value: {x: 0, y: 0, z: 0} 563 | m_RenderMode: 0 564 | m_ValidateTrueMetals: 0 565 | m_SceneViewState: 566 | showFog: 1 567 | showMaterialUpdate: 0 568 | showSkybox: 1 569 | showFlares: 1 570 | showImageEffects: 1 571 | grid: 572 | xGrid: 573 | m_Target: 0 574 | speed: 2 575 | m_Value: 0 576 | yGrid: 577 | m_Target: 1 578 | speed: 2 579 | m_Value: 1 580 | zGrid: 581 | m_Target: 0 582 | speed: 2 583 | m_Value: 0 584 | m_Rotation: 585 | m_Target: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226} 586 | speed: 2 587 | m_Value: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226} 588 | m_Size: 589 | m_Target: 10 590 | speed: 2 591 | m_Value: 10 592 | m_Ortho: 593 | m_Target: 0 594 | speed: 2 595 | m_Value: 0 596 | m_LastSceneViewRotation: {x: 0, y: 0, z: 0, w: 0} 597 | m_LastSceneViewOrtho: 0 598 | m_ReplacementShader: {fileID: 0} 599 | m_ReplacementString: 600 | m_LastLockedObject: {fileID: 0} 601 | m_ViewIsLockedToObject: 0 602 | --- !u!114 &17 603 | MonoBehaviour: 604 | m_ObjectHideFlags: 52 605 | m_PrefabParentObject: {fileID: 0} 606 | m_PrefabInternal: {fileID: 0} 607 | m_GameObject: {fileID: 0} 608 | m_Enabled: 1 609 | m_EditorHideFlags: 1 610 | m_Script: {fileID: 12061, guid: 0000000000000000e000000000000000, type: 0} 611 | m_Name: 612 | m_EditorClassIdentifier: 613 | m_AutoRepaintOnSceneChange: 0 614 | m_MinSize: {x: 200, y: 200} 615 | m_MaxSize: {x: 4000, y: 4000} 616 | m_TitleContent: 617 | m_Text: Hierarchy 618 | m_Image: {fileID: -590624980919486359, guid: 0000000000000000d000000000000000, 619 | type: 0} 620 | m_Tooltip: 621 | m_DepthBufferBits: 0 622 | m_Pos: 623 | serializedVersion: 2 624 | x: 2 625 | y: 19 626 | width: 286 627 | height: 445 628 | m_TreeViewState: 629 | scrollPos: {x: 0, y: 0} 630 | m_SelectedIDs: 68fbffff 631 | m_LastClickedID: -1176 632 | m_ExpandedIDs: 7efbffff00000000 633 | m_RenameOverlay: 634 | m_UserAcceptedRename: 0 635 | m_Name: 636 | m_OriginalName: 637 | m_EditFieldRect: 638 | serializedVersion: 2 639 | x: 0 640 | y: 0 641 | width: 0 642 | height: 0 643 | m_UserData: 0 644 | m_IsWaitingForDelay: 0 645 | m_IsRenaming: 0 646 | m_OriginalEventType: 11 647 | m_IsRenamingFilename: 0 648 | m_ClientGUIView: {fileID: 0} 649 | m_SearchString: 650 | m_ExpandedScenes: 651 | - 652 | m_CurrenRootInstanceID: 0 653 | m_Locked: 0 654 | m_CurrentSortingName: TransformSorting 655 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Layout.wlt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5ceb394a211e714bb882f8f9d542125 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Readme.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 3c7d8f489dda4e24887a3e2221c0771a, type: 3} 13 | m_Name: Readme 14 | m_EditorClassIdentifier: 15 | icon: {fileID: 2800000, guid: b9c816d794290bb4b964a6f6bd962e74, type: 3} 16 | title: 17 | sections: 18 | - heading: Hello! This is a small example of using the RakNet network engine. 19 | text: Open the TestCLSV scene and start the server and then the client. I tried 20 | to comment the code only in those places where it is necessary, so if you don't 21 | really fumble in the code, it's better not to touch anything :) Otherwise everything 22 | will break and there will be questions :) 23 | linkText: Subscribe to my channel! :) 24 | url: https://www.youtube.com/channel/UCPQ04Xpbbw2uGc1gsZtO3HQ 25 | loadedLayout: 0 26 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Readme.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bed0bae8c515fc64b987506ac47cd7e1 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Readme.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | public class Readme : ScriptableObject 5 | { 6 | public Texture2D icon; 7 | public string title; 8 | public Section[] sections; 9 | public bool loadedLayout; 10 | 11 | [Serializable] 12 | public class Section 13 | { 14 | [Multiline] 15 | public string heading; 16 | [Multiline] 17 | public string text; 18 | public string linkText; 19 | public string url; 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/Scripts/Readme/Readme.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c99833250250a62488e84303462c0d23 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19cb475ea49059e4186588de3cc08865 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Client.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee066314d8b1b12429c5d7087a5d2d6f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Client/TestClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | public class TestClient : BaseNetworkClient 6 | { 7 | 8 | packet_ClientData packet_ClientData = new packet_ClientData(); 9 | 10 | public override void OnReceivedData(ArraySegment data) 11 | { 12 | PacketIDs packet_id = (PacketIDs)data.Array[0]; 13 | 14 | switch (packet_id) 15 | { 16 | case PacketIDs.CLIENT_DATA_REQUEST: 17 | 18 | 19 | packet_ClientData.CreatePacket(client_peer, (byte)PacketIDs.CLIENT_DATA); 20 | packet_ClientData.BeginWritePacket(); 21 | packet_ClientData.username = UserNameField.text; 22 | packet_ClientData.version = Application.version; 23 | packet_ClientData.EndWritePacket(); 24 | packet_ClientData.SendToServer(); 25 | 26 | break; 27 | 28 | case PacketIDs.CLIENT_DATA: 29 | packet_ClientData.Unpack(client_peer, data); 30 | Debug.Log("Client data processed by server :) username="+packet_ClientData.username); 31 | break; 32 | } 33 | } 34 | 35 | public override void OnInit() 36 | { 37 | ConnectBtn.onClick.AddListener(() => 38 | { 39 | int port = 0; 40 | if(int.TryParse(PortField.text,out int result)) 41 | { 42 | port = result; 43 | } 44 | Connect(AddressField.text, port); 45 | } 46 | ); 47 | 48 | DisconnectBtn.onClick.AddListener(() => 49 | { 50 | Disconnect(); 51 | } 52 | ); 53 | } 54 | 55 | public Button ConnectBtn; 56 | public Button DisconnectBtn; 57 | public InputField AddressField; 58 | public InputField PortField; 59 | public InputField UserNameField; 60 | } 61 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Client/TestClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5db43813b5b4d294684fbe42d1a2a002 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Server.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc1f34c3945f0784c9f830e9a23bb941 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Server/TestServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | using static RakNet_Enums; 6 | 7 | public class TestServer : BaseNetworkServer 8 | { 9 | /// 10 | /// Method is called when data is received from the client 11 | /// 12 | /// connection - client's native network id 13 | /// data - received data from client 14 | /// data[0] - packet id 15 | public override void OnReceivedData(ulong connection_guid, ArraySegment data) 16 | { 17 | PacketIDs packet_id = (PacketIDs)data.Array[0]; 18 | 19 | switch (packet_id) 20 | { 21 | case PacketIDs.CLIENT_DATA: 22 | 23 | packet_ClientData.Unpack(server_peer, data); 24 | OnReceivedClientData(connection_guid, packet_ClientData); 25 | 26 | 27 | server_peer.GetPingAverage(connection_guid); 28 | server_peer.GetPingLast(connection_guid); 29 | server_peer.GetPingLowest(connection_guid); 30 | 31 | 32 | break; 33 | } 34 | } 35 | 36 | packet_ClientData packet_ClientData = new packet_ClientData(); 37 | 38 | 39 | public List clients = new List(); 40 | 41 | void AddClient(ulong connection_guid,string username,string version) 42 | { 43 | clients.Add( 44 | new ClientData() 45 | { 46 | connection_guid = connection_guid, 47 | username = username, 48 | version = version 49 | } 50 | );//we consider the client to be verified, think about it yourself 51 | Debug.Log(username + " connected!"); 52 | } 53 | 54 | void RemoveClient(ulong connection_guid, DisconnectionType disconnectionType = DisconnectionType.ByUser) 55 | { 56 | for(int i = 0; i < clients.Count; i++) 57 | { 58 | if(clients[i].connection_guid == connection_guid) 59 | { 60 | Debug.Log(clients[i].username+" disconnected! (Disconnect type = "+disconnectionType+")"); 61 | clients.RemoveAt(i); 62 | break; 63 | } 64 | } 65 | } 66 | 67 | public void OnReceivedClientData(ulong connection_guid, packet_ClientData packet) 68 | { 69 | AddClient(connection_guid,packet.username, packet.version); 70 | 71 | packet.CreatePacket(server_peer, (byte)PacketIDs.CLIENT_DATA); 72 | packet.BeginWritePacket(); 73 | packet.EndWritePacket(); 74 | packet.SendToClient(connection_guid); 75 | } 76 | 77 | public override void OnConnected(ulong connection) 78 | { 79 | SendRPC((byte)PacketIDs.CLIENT_DATA_REQUEST, connection);//we request information from the client 80 | } 81 | 82 | public override void OnDisconnected(ulong connection_guid, DisconnectionType type) 83 | { 84 | RemoveClient(connection_guid, type); 85 | } 86 | 87 | public Button StartServerBtn; 88 | public Button StopServerBtn; 89 | 90 | public override void OnInit() 91 | { 92 | StartServerBtn.onClick.AddListener(() => 93 | { 94 | StartServerBtn.gameObject.SetActive(false); 95 | StopServerBtn.gameObject.SetActive(true); 96 | StartServer(); 97 | } 98 | ); 99 | 100 | StopServerBtn.onClick.AddListener(() => 101 | { 102 | StartServerBtn.gameObject.SetActive(true); 103 | StopServerBtn.gameObject.SetActive(false); 104 | StopServer(); 105 | } 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Server/TestServer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 524900d377cfb174ab0aec8f62186d30 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39c6d2dded035b84bb3ac49fd1add999 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared/ClientData.cs: -------------------------------------------------------------------------------- 1 | [System.Serializable] 2 | public class ClientData 3 | { 4 | public ulong connection_guid;//used only on server side 5 | public string username;//user name 6 | public string version;//game version 7 | } 8 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared/ClientData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 038af8425741a394694a5f55db090e19 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared/PacketIDs.cs: -------------------------------------------------------------------------------- 1 | public enum PacketIDs 2 | { 3 | //Warning! Custom package numbers start at 135 because number 134 is used to send the reason for the kick 4 | 5 | CLIENT_DATA_REQUEST = 135, //client data requesting/sending 6 | CLIENT_DATA //client data 7 | } 8 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared/PacketIDs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98344a19d00662f4a8764ae9628306d3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared/packet_ClientData.cs: -------------------------------------------------------------------------------- 1 | public class packet_ClientData : RakNet_Packet 2 | { 3 | protected override void OnDeserialize() 4 | { 5 | username = ReadString(); 6 | version = ReadString(); 7 | } 8 | 9 | protected override void OnSerialize() 10 | { 11 | Write(username); 12 | Write(version); 13 | } 14 | 15 | public string username; 16 | public string version; 17 | } 18 | -------------------------------------------------------------------------------- /Assets/Scripts/TestCode/Shared/packet_ClientData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f1f1931c52a1e3489d16443b3939d45 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/TestCLSV.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 581a2a9cde8cd224486aeef185baaf09 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Library/APIUpdater/project-dependencies.graph: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/APIUpdater/project-dependencies.graph -------------------------------------------------------------------------------- /Library/AnnotationManager: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/AnnotationManager -------------------------------------------------------------------------------- /Library/AssetImportState: -------------------------------------------------------------------------------- 1 | -2;0;0;0;-1 -------------------------------------------------------------------------------- /Library/BuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/BuildSettings.asset -------------------------------------------------------------------------------- /Library/EditorOnlyScriptingSettings.json: -------------------------------------------------------------------------------- 1 | {"m_DefineSymbols":[],"m_AllowUnsafeCode":true} -------------------------------------------------------------------------------- /Library/EditorSnapSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13954, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_SnapEnabled: 0 16 | m_SnapSettings: 17 | m_SnapValue: {x: 0.25, y: 0.25, z: 0.25} 18 | m_SnapMultiplier: {x: 2048, y: 2048, z: 2048} 19 | m_Rotation: 15 20 | m_Scale: 1 21 | -------------------------------------------------------------------------------- /Library/EditorUserBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/EditorUserBuildSettings.asset -------------------------------------------------------------------------------- /Library/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | vcSharedLogLevel: 9 | value: 0d5e400f0650 10 | flags: 0 11 | m_VCAutomaticAdd: 1 12 | m_VCDebugCom: 0 13 | m_VCDebugCmd: 0 14 | m_VCDebugOut: 0 15 | m_SemanticMergeMode: 2 16 | m_VCShowFailedCheckout: 1 17 | m_VCOverwriteFailedCheckoutAssets: 1 18 | m_VCOverlayIcons: 1 19 | m_VCAllowAsyncUpdate: 0 20 | -------------------------------------------------------------------------------- /Library/InspectorExpandedItems.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/InspectorExpandedItems.asset -------------------------------------------------------------------------------- /Library/LastSceneManagerSetup.txt: -------------------------------------------------------------------------------- 1 | sceneSetups: 2 | - path: Assets/TestCLSV.unity 3 | isLoaded: 1 4 | isActive: 1 5 | isSubScene: 0 6 | -------------------------------------------------------------------------------- /Library/LibraryFormatVersion.txt: -------------------------------------------------------------------------------- 1 | unityRebuildLibraryVersion: 11 2 | unityForwardCompatibleVersion: 40 3 | -------------------------------------------------------------------------------- /Library/MonoManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/MonoManager.asset -------------------------------------------------------------------------------- /Library/SceneVisibilityState.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/SceneVisibilityState.asset -------------------------------------------------------------------------------- /Library/ScriptMapper: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/ScriptMapper -------------------------------------------------------------------------------- /Library/SourceAssetDB-lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/SourceAssetDB-lock -------------------------------------------------------------------------------- /Library/SpriteAtlasDatabase.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/SpriteAtlasDatabase.asset -------------------------------------------------------------------------------- /Library/Style.catalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/Style.catalog -------------------------------------------------------------------------------- /Library/expandedItems: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/redheadgektor/RakNet_Networking_DEPRECATED/6a40f58dea4b3fdf1d8798334eee2b9aa4150382/Library/expandedItems -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.2.16", 4 | "com.unity.ide.rider": "1.1.4", 5 | "com.unity.ide.vscode": "1.2.0", 6 | "com.unity.test-framework": "1.1.14", 7 | "com.unity.textmeshpro": "2.0.1", 8 | "com.unity.timeline": "1.2.14", 9 | "com.unity.ugui": "1.0.0", 10 | "com.unity.modules.ai": "1.0.0", 11 | "com.unity.modules.androidjni": "1.0.0", 12 | "com.unity.modules.animation": "1.0.0", 13 | "com.unity.modules.assetbundle": "1.0.0", 14 | "com.unity.modules.audio": "1.0.0", 15 | "com.unity.modules.cloth": "1.0.0", 16 | "com.unity.modules.director": "1.0.0", 17 | "com.unity.modules.imageconversion": "1.0.0", 18 | "com.unity.modules.imgui": "1.0.0", 19 | "com.unity.modules.jsonserialize": "1.0.0", 20 | "com.unity.modules.particlesystem": "1.0.0", 21 | "com.unity.modules.physics": "1.0.0", 22 | "com.unity.modules.physics2d": "1.0.0", 23 | "com.unity.modules.screencapture": "1.0.0", 24 | "com.unity.modules.terrain": "1.0.0", 25 | "com.unity.modules.terrainphysics": "1.0.0", 26 | "com.unity.modules.tilemap": "1.0.0", 27 | "com.unity.modules.ui": "1.0.0", 28 | "com.unity.modules.uielements": "1.0.0", 29 | "com.unity.modules.umbra": "1.0.0", 30 | "com.unity.modules.unityanalytics": "1.0.0", 31 | "com.unity.modules.unitywebrequest": "1.0.0", 32 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 33 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 34 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 35 | "com.unity.modules.unitywebrequestwww": "1.0.0", 36 | "com.unity.modules.vehicles": "1.0.0", 37 | "com.unity.modules.video": "1.0.0", 38 | "com.unity.modules.vr": "1.0.0", 39 | "com.unity.modules.wind": "1.0.0", 40 | "com.unity.modules.xr": "1.0.0" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 20 7 | productGUID: 78a87d25985e2a34c8b580582e1886d9 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: RakNet333 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosUseCustomAppBackgroundBehavior: 0 56 | iosAllowHTTPDownload: 1 57 | allowedAutorotateToPortrait: 1 58 | allowedAutorotateToPortraitUpsideDown: 1 59 | allowedAutorotateToLandscapeRight: 1 60 | allowedAutorotateToLandscapeLeft: 1 61 | useOSAutorotation: 1 62 | use32BitDisplayBuffer: 1 63 | preserveFramebufferAlpha: 0 64 | disableDepthAndStencilBuffers: 0 65 | androidStartInFullscreen: 1 66 | androidRenderOutsideSafeArea: 1 67 | androidUseSwappy: 0 68 | androidBlitType: 0 69 | defaultIsNativeResolution: 1 70 | macRetinaSupport: 1 71 | runInBackground: 1 72 | captureSingleScreen: 0 73 | muteOtherAudioSources: 0 74 | Prepare IOS For Recording: 0 75 | Force IOS Speakers When Recording: 0 76 | deferSystemGesturesMode: 0 77 | hideHomeButton: 0 78 | submitAnalytics: 1 79 | usePlayerLog: 1 80 | bakeCollisionMeshes: 0 81 | forceSingleInstance: 0 82 | useFlipModelSwapchain: 1 83 | resizableWindow: 0 84 | useMacAppStoreValidation: 0 85 | macAppStoreCategory: public.app-category.games 86 | gpuSkinning: 1 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 1 93 | allowFullscreenSwitch: 1 94 | fullscreenMode: 1 95 | xboxSpeechDB: 0 96 | xboxEnableHeadOrientation: 0 97 | xboxEnableGuest: 0 98 | xboxEnablePIXSampling: 0 99 | metalFramebufferOnly: 0 100 | xboxOneResolution: 0 101 | xboxOneSResolution: 0 102 | xboxOneXResolution: 3 103 | xboxOneMonoLoggingLevel: 0 104 | xboxOneLoggingLevel: 1 105 | xboxOneDisableEsram: 0 106 | xboxOneEnableTypeOptimization: 0 107 | xboxOnePresentImmediateThreshold: 0 108 | switchQueueCommandMemory: 0 109 | switchQueueControlMemory: 16384 110 | switchQueueComputeMemory: 262144 111 | switchNVNShaderPoolsGranularity: 33554432 112 | switchNVNDefaultPoolsGranularity: 16777216 113 | switchNVNOtherPoolsGranularity: 16777216 114 | stadiaPresentMode: 0 115 | stadiaTargetFramerate: 0 116 | vulkanNumSwapchainBuffers: 3 117 | vulkanEnableSetSRGBWrite: 0 118 | m_SupportedAspectRatios: 119 | 4:3: 1 120 | 5:4: 1 121 | 16:10: 1 122 | 16:9: 1 123 | Others: 1 124 | bundleVersion: 0.1 125 | preloadedAssets: [] 126 | metroInputSource: 0 127 | wsaTransparentSwapchain: 0 128 | m_HolographicPauseOnTrackingLoss: 1 129 | xboxOneDisableKinectGpuReservation: 1 130 | xboxOneEnable7thCore: 1 131 | vrSettings: 132 | cardboard: 133 | depthFormat: 0 134 | enableTransitionView: 0 135 | daydream: 136 | depthFormat: 0 137 | useSustainedPerformanceMode: 0 138 | enableVideoLayer: 0 139 | useProtectedVideoMemory: 0 140 | minimumSupportedHeadTracking: 0 141 | maximumSupportedHeadTracking: 1 142 | hololens: 143 | depthFormat: 1 144 | depthBufferSharingEnabled: 1 145 | lumin: 146 | depthFormat: 0 147 | frameTiming: 2 148 | enableGLCache: 0 149 | glCacheMaxBlobSize: 524288 150 | glCacheMaxFileSize: 8388608 151 | oculus: 152 | sharedDepthBuffer: 1 153 | dashSupport: 1 154 | lowOverheadMode: 0 155 | protectedContext: 0 156 | v2Signing: 1 157 | enable360StereoCapture: 0 158 | isWsaHolographicRemotingEnabled: 0 159 | enableFrameTimingStats: 0 160 | useHDRDisplay: 0 161 | D3DHDRBitDepth: 0 162 | m_ColorGamuts: 00000000 163 | targetPixelDensity: 30 164 | resolutionScalingMode: 0 165 | androidSupportedAspectRatio: 1 166 | androidMaxAspectRatio: 2.1 167 | applicationIdentifier: {} 168 | buildNumber: {} 169 | AndroidBundleVersionCode: 1 170 | AndroidMinSdkVersion: 19 171 | AndroidTargetSdkVersion: 0 172 | AndroidPreferredInstallLocation: 1 173 | aotOptions: 174 | stripEngineCode: 1 175 | iPhoneStrippingLevel: 0 176 | iPhoneScriptCallOptimization: 0 177 | ForceInternetPermission: 0 178 | ForceSDCardPermission: 0 179 | CreateWallpaper: 0 180 | APKExpansionFiles: 0 181 | keepLoadedShadersAlive: 0 182 | StripUnusedMeshComponents: 1 183 | VertexChannelCompressionMask: 4054 184 | iPhoneSdkVersion: 988 185 | iOSTargetOSVersionString: 10.0 186 | tvOSSdkVersion: 0 187 | tvOSRequireExtendedGameController: 0 188 | tvOSTargetOSVersionString: 10.0 189 | uIPrerenderedIcon: 0 190 | uIRequiresPersistentWiFi: 0 191 | uIRequiresFullScreen: 1 192 | uIStatusBarHidden: 1 193 | uIExitOnSuspend: 0 194 | uIStatusBarStyle: 0 195 | appleTVSplashScreen: {fileID: 0} 196 | appleTVSplashScreen2x: {fileID: 0} 197 | tvOSSmallIconLayers: [] 198 | tvOSSmallIconLayers2x: [] 199 | tvOSLargeIconLayers: [] 200 | tvOSLargeIconLayers2x: [] 201 | tvOSTopShelfImageLayers: [] 202 | tvOSTopShelfImageLayers2x: [] 203 | tvOSTopShelfImageWideLayers: [] 204 | tvOSTopShelfImageWideLayers2x: [] 205 | iOSLaunchScreenType: 0 206 | iOSLaunchScreenPortrait: {fileID: 0} 207 | iOSLaunchScreenLandscape: {fileID: 0} 208 | iOSLaunchScreenBackgroundColor: 209 | serializedVersion: 2 210 | rgba: 0 211 | iOSLaunchScreenFillPct: 100 212 | iOSLaunchScreenSize: 100 213 | iOSLaunchScreenCustomXibPath: 214 | iOSLaunchScreeniPadType: 0 215 | iOSLaunchScreeniPadImage: {fileID: 0} 216 | iOSLaunchScreeniPadBackgroundColor: 217 | serializedVersion: 2 218 | rgba: 0 219 | iOSLaunchScreeniPadFillPct: 100 220 | iOSLaunchScreeniPadSize: 100 221 | iOSLaunchScreeniPadCustomXibPath: 222 | iOSUseLaunchScreenStoryboard: 0 223 | iOSLaunchScreenCustomStoryboardPath: 224 | iOSDeviceRequirements: [] 225 | iOSURLSchemes: [] 226 | iOSBackgroundModes: 0 227 | iOSMetalForceHardShadows: 0 228 | metalEditorSupport: 1 229 | metalAPIValidation: 1 230 | iOSRenderExtraFrameOnPause: 0 231 | appleDeveloperTeamID: 232 | iOSManualSigningProvisioningProfileID: 233 | tvOSManualSigningProvisioningProfileID: 234 | iOSManualSigningProvisioningProfileType: 0 235 | tvOSManualSigningProvisioningProfileType: 0 236 | appleEnableAutomaticSigning: 0 237 | iOSRequireARKit: 0 238 | iOSAutomaticallyDetectAndAddCapabilities: 1 239 | appleEnableProMotion: 0 240 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 241 | templatePackageId: com.unity.template.3d@4.2.8 242 | templateDefaultScene: Assets/Scenes/SampleScene.unity 243 | AndroidTargetArchitectures: 1 244 | AndroidSplashScreenScale: 0 245 | androidSplashScreen: {fileID: 0} 246 | AndroidKeystoreName: 247 | AndroidKeyaliasName: 248 | AndroidBuildApkPerCpuArchitecture: 0 249 | AndroidTVCompatibility: 0 250 | AndroidIsGame: 1 251 | AndroidEnableTango: 0 252 | androidEnableBanner: 1 253 | androidUseLowAccuracyLocation: 0 254 | androidUseCustomKeystore: 0 255 | m_AndroidBanners: 256 | - width: 320 257 | height: 180 258 | banner: {fileID: 0} 259 | androidGamepadSupportLevel: 0 260 | AndroidValidateAppBundleSize: 1 261 | AndroidAppBundleSizeToValidate: 150 262 | m_BuildTargetIcons: [] 263 | m_BuildTargetPlatformIcons: [] 264 | m_BuildTargetBatching: 265 | - m_BuildTarget: Standalone 266 | m_StaticBatching: 1 267 | m_DynamicBatching: 0 268 | - m_BuildTarget: tvOS 269 | m_StaticBatching: 1 270 | m_DynamicBatching: 0 271 | - m_BuildTarget: Android 272 | m_StaticBatching: 1 273 | m_DynamicBatching: 0 274 | - m_BuildTarget: iPhone 275 | m_StaticBatching: 1 276 | m_DynamicBatching: 0 277 | - m_BuildTarget: WebGL 278 | m_StaticBatching: 0 279 | m_DynamicBatching: 0 280 | m_BuildTargetGraphicsJobs: 281 | - m_BuildTarget: MacStandaloneSupport 282 | m_GraphicsJobs: 0 283 | - m_BuildTarget: Switch 284 | m_GraphicsJobs: 1 285 | - m_BuildTarget: MetroSupport 286 | m_GraphicsJobs: 1 287 | - m_BuildTarget: AppleTVSupport 288 | m_GraphicsJobs: 0 289 | - m_BuildTarget: BJMSupport 290 | m_GraphicsJobs: 1 291 | - m_BuildTarget: LinuxStandaloneSupport 292 | m_GraphicsJobs: 1 293 | - m_BuildTarget: PS4Player 294 | m_GraphicsJobs: 1 295 | - m_BuildTarget: iOSSupport 296 | m_GraphicsJobs: 0 297 | - m_BuildTarget: WindowsStandaloneSupport 298 | m_GraphicsJobs: 1 299 | - m_BuildTarget: XboxOnePlayer 300 | m_GraphicsJobs: 1 301 | - m_BuildTarget: LuminSupport 302 | m_GraphicsJobs: 0 303 | - m_BuildTarget: AndroidPlayer 304 | m_GraphicsJobs: 0 305 | - m_BuildTarget: WebGLSupport 306 | m_GraphicsJobs: 0 307 | m_BuildTargetGraphicsJobMode: 308 | - m_BuildTarget: PS4Player 309 | m_GraphicsJobMode: 0 310 | - m_BuildTarget: XboxOnePlayer 311 | m_GraphicsJobMode: 0 312 | m_BuildTargetGraphicsAPIs: 313 | - m_BuildTarget: AndroidPlayer 314 | m_APIs: 150000000b000000 315 | m_Automatic: 0 316 | - m_BuildTarget: iOSSupport 317 | m_APIs: 10000000 318 | m_Automatic: 1 319 | - m_BuildTarget: AppleTVSupport 320 | m_APIs: 10000000 321 | m_Automatic: 0 322 | - m_BuildTarget: WebGLSupport 323 | m_APIs: 0b000000 324 | m_Automatic: 1 325 | m_BuildTargetVRSettings: 326 | - m_BuildTarget: Standalone 327 | m_Enabled: 0 328 | m_Devices: 329 | - Oculus 330 | - OpenVR 331 | openGLRequireES31: 0 332 | openGLRequireES31AEP: 0 333 | openGLRequireES32: 0 334 | m_TemplateCustomTags: {} 335 | mobileMTRendering: 336 | Android: 1 337 | iPhone: 1 338 | tvOS: 1 339 | m_BuildTargetGroupLightmapEncodingQuality: [] 340 | m_BuildTargetGroupLightmapSettings: [] 341 | playModeTestRunnerEnabled: 0 342 | runPlayModeTestAsEditModeTest: 0 343 | actionOnDotNetUnhandledException: 1 344 | enableInternalProfiler: 0 345 | logObjCUncaughtExceptions: 1 346 | enableCrashReportAPI: 0 347 | cameraUsageDescription: 348 | locationUsageDescription: 349 | microphoneUsageDescription: 350 | switchNetLibKey: 351 | switchSocketMemoryPoolSize: 6144 352 | switchSocketAllocatorPoolSize: 128 353 | switchSocketConcurrencyLimit: 14 354 | switchScreenResolutionBehavior: 2 355 | switchUseCPUProfiler: 0 356 | switchApplicationID: 0x01004b9000490000 357 | switchNSODependencies: 358 | switchTitleNames_0: 359 | switchTitleNames_1: 360 | switchTitleNames_2: 361 | switchTitleNames_3: 362 | switchTitleNames_4: 363 | switchTitleNames_5: 364 | switchTitleNames_6: 365 | switchTitleNames_7: 366 | switchTitleNames_8: 367 | switchTitleNames_9: 368 | switchTitleNames_10: 369 | switchTitleNames_11: 370 | switchTitleNames_12: 371 | switchTitleNames_13: 372 | switchTitleNames_14: 373 | switchPublisherNames_0: 374 | switchPublisherNames_1: 375 | switchPublisherNames_2: 376 | switchPublisherNames_3: 377 | switchPublisherNames_4: 378 | switchPublisherNames_5: 379 | switchPublisherNames_6: 380 | switchPublisherNames_7: 381 | switchPublisherNames_8: 382 | switchPublisherNames_9: 383 | switchPublisherNames_10: 384 | switchPublisherNames_11: 385 | switchPublisherNames_12: 386 | switchPublisherNames_13: 387 | switchPublisherNames_14: 388 | switchIcons_0: {fileID: 0} 389 | switchIcons_1: {fileID: 0} 390 | switchIcons_2: {fileID: 0} 391 | switchIcons_3: {fileID: 0} 392 | switchIcons_4: {fileID: 0} 393 | switchIcons_5: {fileID: 0} 394 | switchIcons_6: {fileID: 0} 395 | switchIcons_7: {fileID: 0} 396 | switchIcons_8: {fileID: 0} 397 | switchIcons_9: {fileID: 0} 398 | switchIcons_10: {fileID: 0} 399 | switchIcons_11: {fileID: 0} 400 | switchIcons_12: {fileID: 0} 401 | switchIcons_13: {fileID: 0} 402 | switchIcons_14: {fileID: 0} 403 | switchSmallIcons_0: {fileID: 0} 404 | switchSmallIcons_1: {fileID: 0} 405 | switchSmallIcons_2: {fileID: 0} 406 | switchSmallIcons_3: {fileID: 0} 407 | switchSmallIcons_4: {fileID: 0} 408 | switchSmallIcons_5: {fileID: 0} 409 | switchSmallIcons_6: {fileID: 0} 410 | switchSmallIcons_7: {fileID: 0} 411 | switchSmallIcons_8: {fileID: 0} 412 | switchSmallIcons_9: {fileID: 0} 413 | switchSmallIcons_10: {fileID: 0} 414 | switchSmallIcons_11: {fileID: 0} 415 | switchSmallIcons_12: {fileID: 0} 416 | switchSmallIcons_13: {fileID: 0} 417 | switchSmallIcons_14: {fileID: 0} 418 | switchManualHTML: 419 | switchAccessibleURLs: 420 | switchLegalInformation: 421 | switchMainThreadStackSize: 1048576 422 | switchPresenceGroupId: 423 | switchLogoHandling: 0 424 | switchReleaseVersion: 0 425 | switchDisplayVersion: 1.0.0 426 | switchStartupUserAccount: 0 427 | switchTouchScreenUsage: 0 428 | switchSupportedLanguagesMask: 0 429 | switchLogoType: 0 430 | switchApplicationErrorCodeCategory: 431 | switchUserAccountSaveDataSize: 0 432 | switchUserAccountSaveDataJournalSize: 0 433 | switchApplicationAttribute: 0 434 | switchCardSpecSize: -1 435 | switchCardSpecClock: -1 436 | switchRatingsMask: 0 437 | switchRatingsInt_0: 0 438 | switchRatingsInt_1: 0 439 | switchRatingsInt_2: 0 440 | switchRatingsInt_3: 0 441 | switchRatingsInt_4: 0 442 | switchRatingsInt_5: 0 443 | switchRatingsInt_6: 0 444 | switchRatingsInt_7: 0 445 | switchRatingsInt_8: 0 446 | switchRatingsInt_9: 0 447 | switchRatingsInt_10: 0 448 | switchRatingsInt_11: 0 449 | switchRatingsInt_12: 0 450 | switchLocalCommunicationIds_0: 451 | switchLocalCommunicationIds_1: 452 | switchLocalCommunicationIds_2: 453 | switchLocalCommunicationIds_3: 454 | switchLocalCommunicationIds_4: 455 | switchLocalCommunicationIds_5: 456 | switchLocalCommunicationIds_6: 457 | switchLocalCommunicationIds_7: 458 | switchParentalControl: 0 459 | switchAllowsScreenshot: 1 460 | switchAllowsVideoCapturing: 1 461 | switchAllowsRuntimeAddOnContentInstall: 0 462 | switchDataLossConfirmation: 0 463 | switchUserAccountLockEnabled: 0 464 | switchSystemResourceMemory: 16777216 465 | switchSupportedNpadStyles: 22 466 | switchNativeFsCacheSize: 32 467 | switchIsHoldTypeHorizontal: 0 468 | switchSupportedNpadCount: 8 469 | switchSocketConfigEnabled: 0 470 | switchTcpInitialSendBufferSize: 32 471 | switchTcpInitialReceiveBufferSize: 64 472 | switchTcpAutoSendBufferSizeMax: 256 473 | switchTcpAutoReceiveBufferSizeMax: 256 474 | switchUdpSendBufferSize: 9 475 | switchUdpReceiveBufferSize: 42 476 | switchSocketBufferEfficiency: 4 477 | switchSocketInitializeEnabled: 1 478 | switchNetworkInterfaceManagerInitializeEnabled: 1 479 | switchPlayerConnectionEnabled: 1 480 | ps4NPAgeRating: 12 481 | ps4NPTitleSecret: 482 | ps4NPTrophyPackPath: 483 | ps4ParentalLevel: 11 484 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 485 | ps4Category: 0 486 | ps4MasterVersion: 01.00 487 | ps4AppVersion: 01.00 488 | ps4AppType: 0 489 | ps4ParamSfxPath: 490 | ps4VideoOutPixelFormat: 0 491 | ps4VideoOutInitialWidth: 1920 492 | ps4VideoOutBaseModeInitialWidth: 1920 493 | ps4VideoOutReprojectionRate: 60 494 | ps4PronunciationXMLPath: 495 | ps4PronunciationSIGPath: 496 | ps4BackgroundImagePath: 497 | ps4StartupImagePath: 498 | ps4StartupImagesFolder: 499 | ps4IconImagesFolder: 500 | ps4SaveDataImagePath: 501 | ps4SdkOverride: 502 | ps4BGMPath: 503 | ps4ShareFilePath: 504 | ps4ShareOverlayImagePath: 505 | ps4PrivacyGuardImagePath: 506 | ps4NPtitleDatPath: 507 | ps4RemotePlayKeyAssignment: -1 508 | ps4RemotePlayKeyMappingDir: 509 | ps4PlayTogetherPlayerCount: 0 510 | ps4EnterButtonAssignment: 1 511 | ps4ApplicationParam1: 0 512 | ps4ApplicationParam2: 0 513 | ps4ApplicationParam3: 0 514 | ps4ApplicationParam4: 0 515 | ps4DownloadDataSize: 0 516 | ps4GarlicHeapSize: 2048 517 | ps4ProGarlicHeapSize: 2560 518 | playerPrefsMaxSize: 32768 519 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 520 | ps4pnSessions: 1 521 | ps4pnPresence: 1 522 | ps4pnFriends: 1 523 | ps4pnGameCustomData: 1 524 | playerPrefsSupport: 0 525 | enableApplicationExit: 0 526 | resetTempFolder: 1 527 | restrictedAudioUsageRights: 0 528 | ps4UseResolutionFallback: 0 529 | ps4ReprojectionSupport: 0 530 | ps4UseAudio3dBackend: 0 531 | ps4UseLowGarlicFragmentationMode: 1 532 | ps4SocialScreenEnabled: 0 533 | ps4ScriptOptimizationLevel: 0 534 | ps4Audio3dVirtualSpeakerCount: 14 535 | ps4attribCpuUsage: 0 536 | ps4PatchPkgPath: 537 | ps4PatchLatestPkgPath: 538 | ps4PatchChangeinfoPath: 539 | ps4PatchDayOne: 0 540 | ps4attribUserManagement: 0 541 | ps4attribMoveSupport: 0 542 | ps4attrib3DSupport: 0 543 | ps4attribShareSupport: 0 544 | ps4attribExclusiveVR: 0 545 | ps4disableAutoHideSplash: 0 546 | ps4videoRecordingFeaturesUsed: 0 547 | ps4contentSearchFeaturesUsed: 0 548 | ps4attribEyeToEyeDistanceSettingVR: 0 549 | ps4IncludedModules: [] 550 | ps4attribVROutputEnabled: 0 551 | monoEnv: 552 | splashScreenBackgroundSourceLandscape: {fileID: 0} 553 | splashScreenBackgroundSourcePortrait: {fileID: 0} 554 | blurSplashScreenBackground: 1 555 | spritePackerPolicy: 556 | webGLMemorySize: 16 557 | webGLExceptionSupport: 1 558 | webGLNameFilesAsHashes: 0 559 | webGLDataCaching: 1 560 | webGLDebugSymbols: 0 561 | webGLEmscriptenArgs: 562 | webGLModulesDirectory: 563 | webGLTemplate: APPLICATION:Default 564 | webGLAnalyzeBuildSize: 0 565 | webGLUseEmbeddedResources: 0 566 | webGLCompressionFormat: 1 567 | webGLLinkerTarget: 1 568 | webGLThreadsSupport: 0 569 | webGLWasmStreaming: 0 570 | scriptingDefineSymbols: {} 571 | platformArchitecture: {} 572 | scriptingBackend: {} 573 | il2cppCompilerConfiguration: {} 574 | managedStrippingLevel: {} 575 | incrementalIl2cppBuild: {} 576 | allowUnsafeCode: 1 577 | additionalIl2CppArgs: 578 | scriptingRuntimeVersion: 1 579 | gcIncremental: 0 580 | gcWBarrierValidation: 0 581 | apiCompatibilityLevelPerPlatform: {} 582 | m_RenderingPath: 1 583 | m_MobileRenderingPath: 1 584 | metroPackageName: Template_3D 585 | metroPackageVersion: 586 | metroCertificatePath: 587 | metroCertificatePassword: 588 | metroCertificateSubject: 589 | metroCertificateIssuer: 590 | metroCertificateNotAfter: 0000000000000000 591 | metroApplicationDescription: Template_3D 592 | wsaImages: {} 593 | metroTileShortName: 594 | metroTileShowName: 0 595 | metroMediumTileShowName: 0 596 | metroLargeTileShowName: 0 597 | metroWideTileShowName: 0 598 | metroSupportStreamingInstall: 0 599 | metroLastRequiredScene: 0 600 | metroDefaultTileSize: 1 601 | metroTileForegroundText: 2 602 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 603 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 604 | a: 1} 605 | metroSplashScreenUseBackgroundColor: 0 606 | platformCapabilities: {} 607 | metroTargetDeviceFamilies: {} 608 | metroFTAName: 609 | metroFTAFileTypes: [] 610 | metroProtocolName: 611 | XboxOneProductId: 612 | XboxOneUpdateKey: 613 | XboxOneSandboxId: 614 | XboxOneContentId: 615 | XboxOneTitleId: 616 | XboxOneSCId: 617 | XboxOneGameOsOverridePath: 618 | XboxOnePackagingOverridePath: 619 | XboxOneAppManifestOverridePath: 620 | XboxOneVersion: 1.0.0.0 621 | XboxOnePackageEncryption: 0 622 | XboxOnePackageUpdateGranularity: 2 623 | XboxOneDescription: 624 | XboxOneLanguage: 625 | - enus 626 | XboxOneCapability: [] 627 | XboxOneGameRating: {} 628 | XboxOneIsContentPackage: 0 629 | XboxOneEnableGPUVariability: 1 630 | XboxOneSockets: {} 631 | XboxOneSplashScreen: {fileID: 0} 632 | XboxOneAllowedProductIds: [] 633 | XboxOnePersistentLocalStorageSize: 0 634 | XboxOneXTitleMemory: 8 635 | XboxOneOverrideIdentityName: 636 | XboxOneOverrideIdentityPublisher: 637 | vrEditorSettings: 638 | daydream: 639 | daydreamIconForeground: {fileID: 0} 640 | daydreamIconBackground: {fileID: 0} 641 | cloudServicesEnabled: 642 | UNet: 1 643 | luminIcon: 644 | m_Name: 645 | m_ModelFolderPath: 646 | m_PortalFolderPath: 647 | luminCert: 648 | m_CertPath: 649 | m_SignPackage: 1 650 | luminIsChannelApp: 0 651 | luminVersion: 652 | m_VersionCode: 1 653 | m_VersionName: 654 | apiCompatibilityLevel: 6 655 | cloudProjectId: 656 | framebufferDepthMemorylessMode: 0 657 | projectName: 658 | organizationId: 659 | cloudEnabled: 0 660 | enableNativePlatformBackendsForNewInputSystem: 0 661 | disableOldInputManagerSupport: 0 662 | legacyClampBlendShapeWeights: 0 663 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.3.15f1 2 | m_EditorVersionWithRevision: 2019.3.15f1 (59ff3e03856d) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Stadia: 5 227 | Standalone: 5 228 | WebGL: 3 229 | Windows Store Apps: 5 230 | XboxOne: 5 231 | iPhone: 2 232 | tvOS: 2 233 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RakNet For Unity3D 2 | This is an updated version of the wrapper for the native library of the RakNet network engine. 3 | 4 | ## How to use it 5 | In order to use The raknet network engine in your project, I recommend that you study the test client and server. 6 | 7 | Download this repository and place the downloaded files in a convenient location then run Unity3D 8 | 9 | If you have this error 10 | 11 | ![Alt-текст](https://i.imgur.com/hPcyZQu.png "Error on compiling") 12 | 13 | Check the box in Player Settings -> Allow 'unsafe' Code 14 | ![Alt-текст](https://i.imgur.com/1kPPo5S.png "Fixing error") 15 | 16 | Next, open the test scene, and click the button to establish a connection between the client and server and see the editor console. If you see messages that the client has joined then everything is fine. You can easily modify the code and try sending other data. 17 | 18 | The base client and server already have all the functionality for receiving and sending data, you just need to inherit from the BaseClientNetwork and BaseServerNetwork classes 19 | 20 | ### I apologize in advance for the water in the text I try to explain as much as possible :) 21 | 22 | ### How to read received data? 23 | 24 | The Base Client Network class has a virtual method OnReceivedData (ArraySegment data); which is called when the client receives data from the server. 25 | 26 | The Base Server Network class has a similar method OnReceivedData(ulong connection_guid, ArraySegment data); 27 | 28 | They differ in that the server side method has the 'connection_guid' argument, but more on that later. 29 | 30 | When receiving data (both on the client side and on the server side), the first element of the array is the packet number, followed by other data that was written by the sender. 31 | 32 | To convert bytes to types (int,float, string, etc.), you need to call Unpack() method for packet, specifying server_peer and the array itself with data. After that, the data will be converted to types and you can continue working with them. 33 | 34 | ##### Overrided method 35 | ![Alt-текст](https://i.imgur.com/ICp14Hg.png "Method") 36 | 37 | **It is important to follow the sequence of reading the sent data, if suddenly there is no data in the sent buffer, a non-critical error occurs. You just don't get the value and that's it.** 38 | ###### Structure of the client data packet 39 | ```csharp 40 | public class packet_ClientData : RakNet_Packet //Any class can be converted to a packet, the main thing is just to inherit from the RakNet_Packet class 41 | { 42 | //deserialization method is called when the packet is unpacked (see the screenshot above), here we convert bytes to types (float, int, string, etc.) 43 | protected override void OnDeserialize() 44 | { 45 | username = ReadString(); 46 | version = ReadString(); 47 | } 48 | 49 | //serialization occurs when the Begin Write Packet method is called (more on this later) 50 | protected override void OnSerialize() 51 | { 52 | Write(username); 53 | Write(version); 54 | } 55 | 56 | public string username; 57 | public string version; 58 | } 59 | ``` 60 | 61 | You can read data directly without creating packet classes, just refer to the RakNet_Peer class that is specified in the client (client_peer) and in the server (server_peer). It has almost all the main types for writing and reading. 62 | 63 | ###### Example of reading data without the use RakNet_Packet 64 | 65 | ```csharp 66 | //reading on client side 67 | void ReadData() 68 | { 69 | byte packet_id = client_peer.ReadByte();//first read packet id 70 | if(packet_id == 255)//as an example 71 | { 72 | client_peer.ReadInt();//12345 73 | client_peer.ReadString();//hello world! 74 | } 75 | } 76 | 77 | //writing on server side 78 | void WriteData() 79 | { 80 | server_peer.BeginWrite(); 81 | server_peer.Write((byte)255);//write packet id 82 | server_peer.Write((int)12345); 83 | server_peer.Write("Hello world!"); 84 | server_peer.SendToClient(123456789012345);//sending to client by guid 85 | } 86 | ``` 87 | 88 | I recommend using classes for processing information because it is much more convenient :) 89 | 90 | 91 | ### How to write data? 92 | 93 | ```csharp 94 | //Creating a packet with an ID on client side 95 | packet_ClientData.CreatePacket(client_peer, (byte)PacketIDs.CLIENT_DATA); 96 | packet_ClientData.BeginWritePacket(); 97 | packet_ClientData.username = UserNameField.text; 98 | packet_ClientData.version = Application.version; 99 | packet_ClientData.EndWritePacket(); 100 | packet_ClientData.SendToServer();//sending packet to the server 101 | 102 | //Read packet on server side 103 | packet_ClientData.Unpack(server_peer, data); 104 | OnReceivedClientData(connection_guid, packet_ClientData); 105 | ``` 106 | 107 | ### How to get ping? 108 | 109 | ```csharp 110 | //get client ping 111 | BaseNetworkClient.GetPingAverage(); 112 | BaseNetworkClient.GetPingLast(); 113 | BaseNetworkClient.GetPingLowest(); 114 | 115 | client_peer.GetPingAverage(); 116 | client_peer.GetPingLast(); 117 | client_peer.GetPingLowest(); 118 | 119 | //get client ping on server side 120 | ulong connection_guid = 1234567890123;//client guid 121 | 122 | server_peer.GetPingAverage(connection_guid); 123 | server_peer.GetPingLast(connection_guid); 124 | server_peer.GetPingLowest(connection_guid); 125 | 126 | ``` 127 | --------------------------------------------------------------------------------