├── .gitignore ├── .vscode └── settings.json ├── Makefile ├── README.md ├── UnityCLI.csproj ├── bin ├── .gitignore └── UnityCLI.dll ├── doc └── CLI.png ├── example ├── .gitignore ├── Assets │ ├── 1_Singleton.meta │ ├── 1_Singleton │ │ ├── Singleton.cs │ │ ├── Singleton.cs.meta │ │ ├── Singleton.unity │ │ └── Singleton.unity.meta │ ├── 2_ClassBinding.meta │ ├── 2_ClassBinding │ │ ├── ClassBinding.cs │ │ ├── ClassBinding.cs.meta │ │ ├── ClassBinding.unity │ │ └── ClassBinding.unity.meta │ ├── 3_MultipleChannels.meta │ ├── 3_MultipleChannels │ │ ├── MultipleChannels.cs │ │ ├── MultipleChannels.cs.meta │ │ ├── MultipleChannels.unity │ │ └── MultipleChannels.unity.meta │ ├── UnityCLI.dll │ └── UnityCLI.dll.meta └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── Physics2DSettings.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ └── UnityConnectSettings.asset ├── libs └── UnityEngine.dll └── src ├── Bridge.cs ├── Command.cs ├── Communicator.cs ├── Executer.cs ├── IExecuter.cs └── Result.cs /.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.gitignore": true, 4 | "**/*.meta": true, 5 | "**/*.mdb": true, 6 | "bin": true, 7 | "obj": true, 8 | "lib": true, 9 | "example": true 10 | } 11 | } -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | xbuild /p:Configuration=Release 3 | cp bin/UnityCLI.dll example/Assets 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnityCLI 2 | ![][CLIImage] 3 | 4 | Unity TCP CLI communication for debugging 5 | 6 | # About This Plugin 7 | Making debugging menu is always tedious. 8 | It's also too complex to present every debugging UIs for all the features. 9 | With UnityCLI, you can send commands any debugging logics to the target device without UI. 10 | 11 | # Platform 12 | This plugin is implemented by using .Net's System.Net, so it's platform-independent. 13 | You can send commands from PC to mobile device. 14 | If you have TCP terminal on your mobile device, then it's also possible to send commands from that device. 15 | 16 | # How To Use 17 | 1. Copy bin/UnityCLI.dll to your project. 18 | 19 | 2. To open communication, call ```CLI.Bridge.TryInstall```. 20 | ```cs 21 | CLI.Bridge.TryInstall({SOME_PORT}, {SOME_WELCOME_MESSAGE}) 22 | ``` 23 | This will create singleton, which opens TCP connection at {SOME_PORT}. 24 | If you want to communicate upon more than one port, just attach ```CLI.Bridge``` MonoBehaviour on any of your GameObject. 25 | 26 | 3. Bind your own CLI logic to ```CLI.Bridge``` like below. 27 | ```cs 28 | void BindExecuteCmd() 29 | { 30 | var inst = CLI.Bridge.Instance; 31 | inst.ExecuteCmd = ExecuteCmd; 32 | } 33 | 34 | CLI.Result ExecuteCmd(CLI.Command cmd) 35 | { 36 | switch (cmd.Exe) 37 | { 38 | case "realtimeSinceStartup": 39 | return CLI.Result.Success("now: " + Time.realtimeSinceStartup); 40 | case "timescale": 41 | var newTimescale = float.Parse(cmd.Args[0]); 42 | Time.timeScale = newTimescale; 43 | return CLI.Result.Success("set timescale: " + newTimescale); 44 | default: 45 | return CLI.Result.InvalidCmd(cmd); 46 | } 47 | } 48 | ``` 49 | 50 | 4. Build and play your game on target device. 51 | 52 | 5. To make connection from PC (OSX) to target device, you can use any TCP connection tools. 53 | 54 | If you are on OSX, then this can be easily done with ```nc```. 55 | Open your terminal and enter below. 56 | ``` 57 | nc {TARGET_DEVICE_IP} {TARGET_DEVICE_PORT} 58 | ``` 59 | Make sure that PC and target device are reachable each other. 60 | To check reachable, on terminal, enter ```ping {TARGET_DEVICE_IP}```. 61 | 62 | # Contribution 63 | To build DLL, enter ```make``` on your terminal. 64 | The output DLL will be placed in bin/UnityCLI.dll 65 | 66 | [CLIImage]: https://raw.githubusercontent.com/devsisters/UnityCLI/master/doc/CLI.png?token=ACr4DNTruH4ygqDJ4T6wdOT7ORichPBXks5Y02GcwA%3D%3D 67 | -------------------------------------------------------------------------------- /UnityCLI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | 9 | {F07C9A92-C204-4E09-A5FF-53BEBC8430B4} 10 | Library 11 | Properties 12 | UnityCLI 13 | v3.5 14 | 512 15 | 16 | 17 | pdbonly 18 | true 19 | bin\ 20 | prompt 21 | 4 22 | 23 | 24 | 25 | 26 | libs\UnityEngine.dll 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | *.dll 2 | *.mdb 3 | -------------------------------------------------------------------------------- /bin/UnityCLI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsisters/UnityCLI/57e6fad15e07e09bacc896ba0ebec47902f31511/bin/UnityCLI.dll -------------------------------------------------------------------------------- /doc/CLI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsisters/UnityCLI/57e6fad15e07e09bacc896ba0ebec47902f31511/doc/CLI.png -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | *.sln 2 | *.csproj 3 | .vscode 4 | Library 5 | Temp 6 | -------------------------------------------------------------------------------- /example/Assets/1_Singleton.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cdcb6e20f844c41edb426edb2c5500b1 3 | folderAsset: yes 4 | timeCreated: 1489909553 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example/Assets/1_Singleton/Singleton.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Singleton : MonoBehaviour 4 | { 5 | private void OnEnable() 6 | { 7 | // start TCP/IP communication 8 | const int port = 6670; 9 | const string welcomeMessage = "Hello, Singleton!"; 10 | var cli = CLI.Bridge.TryInstall(port, welcomeMessage: welcomeMessage); 11 | 12 | // bind function 13 | cli.Executer = new CLI.CustomExecuter(ExecuteSingleton); 14 | } 15 | 16 | private CLI.Result ExecuteSingleton(CLI.Command cmd, int argsFrom) 17 | { 18 | switch (cmd[argsFrom]) 19 | { 20 | case "realtimeSinceStartup": 21 | return CLI.Result.Success("now: " + Time.realtimeSinceStartup); 22 | case "timescale": 23 | var newTimescale = float.Parse(cmd.Args[0]); 24 | Time.timeScale = newTimescale; 25 | return CLI.Result.Success("set timescale: " + newTimescale); 26 | default: 27 | return CLI.Result.InvalidCmd(cmd); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/Assets/1_Singleton/Singleton.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a05652f38878f43caa3f14c3fc668827 3 | timeCreated: 1489909498 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example/Assets/1_Singleton/Singleton.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 7 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SkyboxMaterial: {fileID: 0} 29 | m_HaloStrength: 0.5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 41 | --- !u!157 &3 42 | LightmapSettings: 43 | m_ObjectHideFlags: 0 44 | serializedVersion: 7 45 | m_GIWorkflowMode: 1 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 0 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 4 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_DirectLightInLightProbes: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_LightingDataAsset: {fileID: 0} 75 | m_RuntimeCPUUsage: 25 76 | --- !u!196 &4 77 | NavMeshSettings: 78 | serializedVersion: 2 79 | m_ObjectHideFlags: 0 80 | m_BuildSettings: 81 | serializedVersion: 2 82 | agentTypeID: 0 83 | agentRadius: 0.5 84 | agentHeight: 2 85 | agentSlope: 45 86 | agentClimb: 0.4 87 | ledgeDropHeight: 0 88 | maxJumpAcrossDistance: 0 89 | minRegionArea: 2 90 | manualCellSize: 0 91 | cellSize: 0.16666667 92 | accuratePlacement: 0 93 | m_NavMeshData: {fileID: 0} 94 | --- !u!1 &428827972 95 | GameObject: 96 | m_ObjectHideFlags: 0 97 | m_PrefabParentObject: {fileID: 0} 98 | m_PrefabInternal: {fileID: 0} 99 | serializedVersion: 5 100 | m_Component: 101 | - component: {fileID: 428827977} 102 | - component: {fileID: 428827976} 103 | - component: {fileID: 428827975} 104 | - component: {fileID: 428827974} 105 | - component: {fileID: 428827973} 106 | m_Layer: 0 107 | m_Name: Main Camera 108 | m_TagString: MainCamera 109 | m_Icon: {fileID: 0} 110 | m_NavMeshLayer: 0 111 | m_StaticEditorFlags: 0 112 | m_IsActive: 1 113 | --- !u!81 &428827973 114 | AudioListener: 115 | m_ObjectHideFlags: 0 116 | m_PrefabParentObject: {fileID: 0} 117 | m_PrefabInternal: {fileID: 0} 118 | m_GameObject: {fileID: 428827972} 119 | m_Enabled: 1 120 | --- !u!124 &428827974 121 | Behaviour: 122 | m_ObjectHideFlags: 0 123 | m_PrefabParentObject: {fileID: 0} 124 | m_PrefabInternal: {fileID: 0} 125 | m_GameObject: {fileID: 428827972} 126 | m_Enabled: 1 127 | --- !u!92 &428827975 128 | Behaviour: 129 | m_ObjectHideFlags: 0 130 | m_PrefabParentObject: {fileID: 0} 131 | m_PrefabInternal: {fileID: 0} 132 | m_GameObject: {fileID: 428827972} 133 | m_Enabled: 1 134 | --- !u!20 &428827976 135 | Camera: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | m_GameObject: {fileID: 428827972} 140 | m_Enabled: 1 141 | serializedVersion: 2 142 | m_ClearFlags: 1 143 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 144 | m_NormalizedViewPortRect: 145 | serializedVersion: 2 146 | x: 0 147 | y: 0 148 | width: 1 149 | height: 1 150 | near clip plane: 0.3 151 | far clip plane: 1000 152 | field of view: 60 153 | orthographic: 1 154 | orthographic size: 5 155 | m_Depth: -1 156 | m_CullingMask: 157 | serializedVersion: 2 158 | m_Bits: 4294967295 159 | m_RenderingPath: -1 160 | m_TargetTexture: {fileID: 0} 161 | m_TargetDisplay: 0 162 | m_TargetEye: 3 163 | m_HDR: 0 164 | m_OcclusionCulling: 1 165 | m_StereoConvergence: 10 166 | m_StereoSeparation: 0.022 167 | m_StereoMirrorMode: 0 168 | --- !u!4 &428827977 169 | Transform: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 428827972} 174 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 175 | m_LocalPosition: {x: 0, y: 0, z: -10} 176 | m_LocalScale: {x: 1, y: 1, z: 1} 177 | m_Children: [] 178 | m_Father: {fileID: 0} 179 | m_RootOrder: 0 180 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 181 | --- !u!1 &1686143161 182 | GameObject: 183 | m_ObjectHideFlags: 0 184 | m_PrefabParentObject: {fileID: 0} 185 | m_PrefabInternal: {fileID: 0} 186 | serializedVersion: 5 187 | m_Component: 188 | - component: {fileID: 1686143163} 189 | - component: {fileID: 1686143162} 190 | m_Layer: 0 191 | m_Name: Main 192 | m_TagString: Untagged 193 | m_Icon: {fileID: 0} 194 | m_NavMeshLayer: 0 195 | m_StaticEditorFlags: 0 196 | m_IsActive: 1 197 | --- !u!114 &1686143162 198 | MonoBehaviour: 199 | m_ObjectHideFlags: 0 200 | m_PrefabParentObject: {fileID: 0} 201 | m_PrefabInternal: {fileID: 0} 202 | m_GameObject: {fileID: 1686143161} 203 | m_Enabled: 1 204 | m_EditorHideFlags: 0 205 | m_Script: {fileID: 11500000, guid: a05652f38878f43caa3f14c3fc668827, type: 3} 206 | m_Name: 207 | m_EditorClassIdentifier: 208 | --- !u!4 &1686143163 209 | Transform: 210 | m_ObjectHideFlags: 0 211 | m_PrefabParentObject: {fileID: 0} 212 | m_PrefabInternal: {fileID: 0} 213 | m_GameObject: {fileID: 1686143161} 214 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 215 | m_LocalPosition: {x: 0, y: 0, z: 0} 216 | m_LocalScale: {x: 1, y: 1, z: 1} 217 | m_Children: [] 218 | m_Father: {fileID: 0} 219 | m_RootOrder: 1 220 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 221 | -------------------------------------------------------------------------------- /example/Assets/1_Singleton/Singleton.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 940adc88e3b7d4ff891a668b61f55313 3 | timeCreated: 1489909585 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example/Assets/2_ClassBinding.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 073a85c43c7dd45ee87a107e8a49eda2 3 | folderAsset: yes 4 | timeCreated: 1489909623 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example/Assets/2_ClassBinding/ClassBinding.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public static class Binding1 4 | { 5 | [CLI.Bind] 6 | public static CLI.Result Foo(int i) 7 | { 8 | return CLI.Result.Success("Foo called: " + i); 9 | } 10 | } 11 | 12 | public static class Binding2 13 | { 14 | [CLI.Bind] 15 | public static CLI.Result Goo(string str) 16 | { 17 | return CLI.Result.Success("Goo called: " + str); 18 | } 19 | } 20 | 21 | public class ClassBinding : MonoBehaviour 22 | { 23 | private void OnEnable() 24 | { 25 | // start TCP/IP communication 26 | const int port = 6670; 27 | const string welcomeMessage = "Hello, ClassBinding!"; 28 | var cli = CLI.Bridge.TryInstall(port, welcomeMessage: welcomeMessage); 29 | 30 | // bind class 31 | cli.Executer = new CLI.Executer() 32 | .Bind(typeof(Binding1)) 33 | .Bind(typeof(Binding2)); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /example/Assets/2_ClassBinding/ClassBinding.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a9c5ad5e90e1494e8e5884a6953d432 3 | timeCreated: 1489909498 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example/Assets/2_ClassBinding/ClassBinding.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 7 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SkyboxMaterial: {fileID: 0} 29 | m_HaloStrength: 0.5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 41 | --- !u!157 &3 42 | LightmapSettings: 43 | m_ObjectHideFlags: 0 44 | serializedVersion: 7 45 | m_GIWorkflowMode: 1 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 0 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 4 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_DirectLightInLightProbes: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_LightingDataAsset: {fileID: 0} 75 | m_RuntimeCPUUsage: 25 76 | --- !u!196 &4 77 | NavMeshSettings: 78 | serializedVersion: 2 79 | m_ObjectHideFlags: 0 80 | m_BuildSettings: 81 | serializedVersion: 2 82 | agentTypeID: 0 83 | agentRadius: 0.5 84 | agentHeight: 2 85 | agentSlope: 45 86 | agentClimb: 0.4 87 | ledgeDropHeight: 0 88 | maxJumpAcrossDistance: 0 89 | minRegionArea: 2 90 | manualCellSize: 0 91 | cellSize: 0.16666667 92 | accuratePlacement: 0 93 | m_NavMeshData: {fileID: 0} 94 | --- !u!1 &1287756147 95 | GameObject: 96 | m_ObjectHideFlags: 0 97 | m_PrefabParentObject: {fileID: 0} 98 | m_PrefabInternal: {fileID: 0} 99 | serializedVersion: 5 100 | m_Component: 101 | - component: {fileID: 1287756149} 102 | - component: {fileID: 1287756148} 103 | m_Layer: 0 104 | m_Name: ClassBinding 105 | m_TagString: Untagged 106 | m_Icon: {fileID: 0} 107 | m_NavMeshLayer: 0 108 | m_StaticEditorFlags: 0 109 | m_IsActive: 1 110 | --- !u!114 &1287756148 111 | MonoBehaviour: 112 | m_ObjectHideFlags: 0 113 | m_PrefabParentObject: {fileID: 0} 114 | m_PrefabInternal: {fileID: 0} 115 | m_GameObject: {fileID: 1287756147} 116 | m_Enabled: 1 117 | m_EditorHideFlags: 0 118 | m_Script: {fileID: 11500000, guid: 8a9c5ad5e90e1494e8e5884a6953d432, type: 3} 119 | m_Name: 120 | m_EditorClassIdentifier: 121 | --- !u!4 &1287756149 122 | Transform: 123 | m_ObjectHideFlags: 0 124 | m_PrefabParentObject: {fileID: 0} 125 | m_PrefabInternal: {fileID: 0} 126 | m_GameObject: {fileID: 1287756147} 127 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 128 | m_LocalPosition: {x: 0, y: 0, z: 0} 129 | m_LocalScale: {x: 1, y: 1, z: 1} 130 | m_Children: [] 131 | m_Father: {fileID: 0} 132 | m_RootOrder: 1 133 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 134 | --- !u!1 &2034921856 135 | GameObject: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | serializedVersion: 5 140 | m_Component: 141 | - component: {fileID: 2034921861} 142 | - component: {fileID: 2034921860} 143 | - component: {fileID: 2034921859} 144 | - component: {fileID: 2034921858} 145 | - component: {fileID: 2034921857} 146 | m_Layer: 0 147 | m_Name: Main Camera 148 | m_TagString: MainCamera 149 | m_Icon: {fileID: 0} 150 | m_NavMeshLayer: 0 151 | m_StaticEditorFlags: 0 152 | m_IsActive: 1 153 | --- !u!81 &2034921857 154 | AudioListener: 155 | m_ObjectHideFlags: 0 156 | m_PrefabParentObject: {fileID: 0} 157 | m_PrefabInternal: {fileID: 0} 158 | m_GameObject: {fileID: 2034921856} 159 | m_Enabled: 1 160 | --- !u!124 &2034921858 161 | Behaviour: 162 | m_ObjectHideFlags: 0 163 | m_PrefabParentObject: {fileID: 0} 164 | m_PrefabInternal: {fileID: 0} 165 | m_GameObject: {fileID: 2034921856} 166 | m_Enabled: 1 167 | --- !u!92 &2034921859 168 | Behaviour: 169 | m_ObjectHideFlags: 0 170 | m_PrefabParentObject: {fileID: 0} 171 | m_PrefabInternal: {fileID: 0} 172 | m_GameObject: {fileID: 2034921856} 173 | m_Enabled: 1 174 | --- !u!20 &2034921860 175 | Camera: 176 | m_ObjectHideFlags: 0 177 | m_PrefabParentObject: {fileID: 0} 178 | m_PrefabInternal: {fileID: 0} 179 | m_GameObject: {fileID: 2034921856} 180 | m_Enabled: 1 181 | serializedVersion: 2 182 | m_ClearFlags: 1 183 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 184 | m_NormalizedViewPortRect: 185 | serializedVersion: 2 186 | x: 0 187 | y: 0 188 | width: 1 189 | height: 1 190 | near clip plane: 0.3 191 | far clip plane: 1000 192 | field of view: 60 193 | orthographic: 1 194 | orthographic size: 5 195 | m_Depth: -1 196 | m_CullingMask: 197 | serializedVersion: 2 198 | m_Bits: 4294967295 199 | m_RenderingPath: -1 200 | m_TargetTexture: {fileID: 0} 201 | m_TargetDisplay: 0 202 | m_TargetEye: 3 203 | m_HDR: 0 204 | m_OcclusionCulling: 1 205 | m_StereoConvergence: 10 206 | m_StereoSeparation: 0.022 207 | m_StereoMirrorMode: 0 208 | --- !u!4 &2034921861 209 | Transform: 210 | m_ObjectHideFlags: 0 211 | m_PrefabParentObject: {fileID: 0} 212 | m_PrefabInternal: {fileID: 0} 213 | m_GameObject: {fileID: 2034921856} 214 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 215 | m_LocalPosition: {x: 0, y: 0, z: -10} 216 | m_LocalScale: {x: 1, y: 1, z: 1} 217 | m_Children: [] 218 | m_Father: {fileID: 0} 219 | m_RootOrder: 0 220 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 221 | -------------------------------------------------------------------------------- /example/Assets/2_ClassBinding/ClassBinding.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9253b8c1bc2b24fe79372cd4dd8f2783 3 | timeCreated: 1489909639 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example/Assets/3_MultipleChannels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d2bf3f6bd4174f068fa356e7c7c38c8 3 | folderAsset: yes 4 | timeCreated: 1489909515 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /example/Assets/3_MultipleChannels/MultipleChannels.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class MultipleChannels : MonoBehaviour 4 | { 5 | public CLI.Bridge Channel1; 6 | public CLI.Bridge Channel2; 7 | public CLI.Bridge Channel3; 8 | 9 | private void OnEnable() 10 | { 11 | Channel1.Executer = new CLI.CustomExecuter(ExecuteChannel1); 12 | Channel2.Executer = new CLI.CustomExecuter(ExecuteChannel2); 13 | Channel3.Executer = new CLI.CustomExecuter(ExecuteChannel3); 14 | } 15 | 16 | private CLI.Result ExecuteChannel1(CLI.Command cmd, int argsFrom) 17 | { 18 | return CLI.Result.Success("[Ch1] " + cmd.Raw); 19 | } 20 | 21 | private CLI.Result ExecuteChannel2(CLI.Command cmd, int argsFrom) 22 | { 23 | return CLI.Result.Success("[Ch2] " + cmd.Raw); 24 | } 25 | 26 | private CLI.Result ExecuteChannel3(CLI.Command cmd, int argsFrom) 27 | { 28 | return CLI.Result.Success("[Ch3] " + cmd.Raw); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/Assets/3_MultipleChannels/MultipleChannels.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a6d6bd18e526456c89ba1679c715a04 3 | timeCreated: 1489909498 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /example/Assets/3_MultipleChannels/MultipleChannels.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 7 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SkyboxMaterial: {fileID: 0} 29 | m_HaloStrength: 0.5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 41 | --- !u!157 &3 42 | LightmapSettings: 43 | m_ObjectHideFlags: 0 44 | serializedVersion: 7 45 | m_GIWorkflowMode: 1 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 0 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 4 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_DirectLightInLightProbes: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_LightingDataAsset: {fileID: 0} 75 | m_RuntimeCPUUsage: 25 76 | --- !u!196 &4 77 | NavMeshSettings: 78 | serializedVersion: 2 79 | m_ObjectHideFlags: 0 80 | m_BuildSettings: 81 | serializedVersion: 2 82 | agentTypeID: 0 83 | agentRadius: 0.5 84 | agentHeight: 2 85 | agentSlope: 45 86 | agentClimb: 0.4 87 | ledgeDropHeight: 0 88 | maxJumpAcrossDistance: 0 89 | minRegionArea: 2 90 | manualCellSize: 0 91 | cellSize: 0.16666667 92 | accuratePlacement: 0 93 | m_NavMeshData: {fileID: 0} 94 | --- !u!1 &1200037568 95 | GameObject: 96 | m_ObjectHideFlags: 0 97 | m_PrefabParentObject: {fileID: 0} 98 | m_PrefabInternal: {fileID: 0} 99 | serializedVersion: 5 100 | m_Component: 101 | - component: {fileID: 1200037573} 102 | - component: {fileID: 1200037572} 103 | - component: {fileID: 1200037571} 104 | - component: {fileID: 1200037570} 105 | - component: {fileID: 1200037569} 106 | m_Layer: 0 107 | m_Name: Main Camera 108 | m_TagString: MainCamera 109 | m_Icon: {fileID: 0} 110 | m_NavMeshLayer: 0 111 | m_StaticEditorFlags: 0 112 | m_IsActive: 1 113 | --- !u!81 &1200037569 114 | AudioListener: 115 | m_ObjectHideFlags: 0 116 | m_PrefabParentObject: {fileID: 0} 117 | m_PrefabInternal: {fileID: 0} 118 | m_GameObject: {fileID: 1200037568} 119 | m_Enabled: 1 120 | --- !u!124 &1200037570 121 | Behaviour: 122 | m_ObjectHideFlags: 0 123 | m_PrefabParentObject: {fileID: 0} 124 | m_PrefabInternal: {fileID: 0} 125 | m_GameObject: {fileID: 1200037568} 126 | m_Enabled: 1 127 | --- !u!92 &1200037571 128 | Behaviour: 129 | m_ObjectHideFlags: 0 130 | m_PrefabParentObject: {fileID: 0} 131 | m_PrefabInternal: {fileID: 0} 132 | m_GameObject: {fileID: 1200037568} 133 | m_Enabled: 1 134 | --- !u!20 &1200037572 135 | Camera: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | m_GameObject: {fileID: 1200037568} 140 | m_Enabled: 1 141 | serializedVersion: 2 142 | m_ClearFlags: 1 143 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 144 | m_NormalizedViewPortRect: 145 | serializedVersion: 2 146 | x: 0 147 | y: 0 148 | width: 1 149 | height: 1 150 | near clip plane: 0.3 151 | far clip plane: 1000 152 | field of view: 60 153 | orthographic: 1 154 | orthographic size: 5 155 | m_Depth: -1 156 | m_CullingMask: 157 | serializedVersion: 2 158 | m_Bits: 4294967295 159 | m_RenderingPath: -1 160 | m_TargetTexture: {fileID: 0} 161 | m_TargetDisplay: 0 162 | m_TargetEye: 3 163 | m_HDR: 0 164 | m_OcclusionCulling: 1 165 | m_StereoConvergence: 10 166 | m_StereoSeparation: 0.022 167 | m_StereoMirrorMode: 0 168 | --- !u!4 &1200037573 169 | Transform: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | m_GameObject: {fileID: 1200037568} 174 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 175 | m_LocalPosition: {x: 0, y: 0, z: -10} 176 | m_LocalScale: {x: 1, y: 1, z: 1} 177 | m_Children: [] 178 | m_Father: {fileID: 0} 179 | m_RootOrder: 0 180 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 181 | --- !u!1 &1968311854 182 | GameObject: 183 | m_ObjectHideFlags: 0 184 | m_PrefabParentObject: {fileID: 0} 185 | m_PrefabInternal: {fileID: 0} 186 | serializedVersion: 5 187 | m_Component: 188 | - component: {fileID: 1968311855} 189 | - component: {fileID: 1968311856} 190 | - component: {fileID: 1968311859} 191 | - component: {fileID: 1968311858} 192 | - component: {fileID: 1968311857} 193 | m_Layer: 0 194 | m_Name: Main 195 | m_TagString: Untagged 196 | m_Icon: {fileID: 0} 197 | m_NavMeshLayer: 0 198 | m_StaticEditorFlags: 0 199 | m_IsActive: 1 200 | --- !u!4 &1968311855 201 | Transform: 202 | m_ObjectHideFlags: 0 203 | m_PrefabParentObject: {fileID: 0} 204 | m_PrefabInternal: {fileID: 0} 205 | m_GameObject: {fileID: 1968311854} 206 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 207 | m_LocalPosition: {x: 0, y: 0, z: 0} 208 | m_LocalScale: {x: 1, y: 1, z: 1} 209 | m_Children: [] 210 | m_Father: {fileID: 0} 211 | m_RootOrder: 1 212 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 213 | --- !u!114 &1968311856 214 | MonoBehaviour: 215 | m_ObjectHideFlags: 0 216 | m_PrefabParentObject: {fileID: 0} 217 | m_PrefabInternal: {fileID: 0} 218 | m_GameObject: {fileID: 1968311854} 219 | m_Enabled: 1 220 | m_EditorHideFlags: 0 221 | m_Script: {fileID: 11500000, guid: 5a6d6bd18e526456c89ba1679c715a04, type: 3} 222 | m_Name: 223 | m_EditorClassIdentifier: 224 | Channel1: {fileID: 1968311859} 225 | Channel2: {fileID: 1968311858} 226 | Channel3: {fileID: 1968311857} 227 | --- !u!114 &1968311857 228 | MonoBehaviour: 229 | m_ObjectHideFlags: 0 230 | m_PrefabParentObject: {fileID: 0} 231 | m_PrefabInternal: {fileID: 0} 232 | m_GameObject: {fileID: 1968311854} 233 | m_Enabled: 1 234 | m_EditorHideFlags: 0 235 | m_Script: {fileID: -292307290, guid: 7e86d1ff47bd84a88923d1e58a1f374f, type: 3} 236 | m_Name: 237 | m_EditorClassIdentifier: 238 | InitialPort: 3333 239 | WelcomeMessage: I'm Channel3 240 | --- !u!114 &1968311858 241 | MonoBehaviour: 242 | m_ObjectHideFlags: 0 243 | m_PrefabParentObject: {fileID: 0} 244 | m_PrefabInternal: {fileID: 0} 245 | m_GameObject: {fileID: 1968311854} 246 | m_Enabled: 1 247 | m_EditorHideFlags: 0 248 | m_Script: {fileID: -292307290, guid: 7e86d1ff47bd84a88923d1e58a1f374f, type: 3} 249 | m_Name: 250 | m_EditorClassIdentifier: 251 | InitialPort: 2222 252 | WelcomeMessage: I'm Channel2 253 | --- !u!114 &1968311859 254 | MonoBehaviour: 255 | m_ObjectHideFlags: 0 256 | m_PrefabParentObject: {fileID: 0} 257 | m_PrefabInternal: {fileID: 0} 258 | m_GameObject: {fileID: 1968311854} 259 | m_Enabled: 1 260 | m_EditorHideFlags: 0 261 | m_Script: {fileID: -292307290, guid: 7e86d1ff47bd84a88923d1e58a1f374f, type: 3} 262 | m_Name: 263 | m_EditorClassIdentifier: 264 | InitialPort: 1111 265 | WelcomeMessage: I'm Channel1 266 | -------------------------------------------------------------------------------- /example/Assets/3_MultipleChannels/MultipleChannels.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b49f170267444a28833e6aed14f4215 3 | timeCreated: 1489585998 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /example/Assets/UnityCLI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsisters/UnityCLI/57e6fad15e07e09bacc896ba0ebec47902f31511/example/Assets/UnityCLI.dll -------------------------------------------------------------------------------- /example/Assets/UnityCLI.dll.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e86d1ff47bd84a88923d1e58a1f374f 3 | timeCreated: 1489589175 4 | licenseType: Free 5 | PluginImporter: 6 | serializedVersion: 1 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | Any: 13 | enabled: 1 14 | settings: {} 15 | Editor: 16 | enabled: 0 17 | settings: 18 | DefaultValueInitialized: true 19 | WindowsStoreApps: 20 | enabled: 0 21 | settings: 22 | CPU: AnyCPU 23 | userData: 24 | assetBundleName: 25 | assetBundleVariant: 26 | -------------------------------------------------------------------------------- /example/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 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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: 3 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_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | -------------------------------------------------------------------------------- /example/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 | - enabled: 1 9 | path: Assets/Main.unity 10 | -------------------------------------------------------------------------------- /example/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: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 1 10 | m_SpritePackerMode: 2 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | -------------------------------------------------------------------------------- /example/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: 9 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 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_TierSettings_Tier1: 43 | renderingPath: 1 44 | useCascadedShadowMaps: 0 45 | m_TierSettings_Tier2: 46 | renderingPath: 1 47 | useCascadedShadowMaps: 0 48 | m_TierSettings_Tier3: 49 | renderingPath: 1 50 | useCascadedShadowMaps: 0 51 | m_DefaultRenderingPath: 1 52 | m_DefaultMobileRenderingPath: 1 53 | m_TierSettings: [] 54 | m_LightmapStripping: 0 55 | m_FogStripping: 0 56 | m_LightmapKeepPlain: 1 57 | m_LightmapKeepDirCombined: 1 58 | m_LightmapKeepDirSeparate: 1 59 | m_LightmapKeepDynamicPlain: 1 60 | m_LightmapKeepDynamicDirCombined: 1 61 | m_LightmapKeepDynamicDirSeparate: 1 62 | m_FogKeepLinear: 1 63 | m_FogKeepExp: 1 64 | m_FogKeepExp2: 1 65 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /example/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: 2 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_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ShowColliderAABB: 0 29 | m_ContactArrowScale: 0.2 30 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 31 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 32 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 33 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 34 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 35 | -------------------------------------------------------------------------------- /example/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: 10 7 | productGUID: 9dd087dbb1b93486f9660a5be8e90682 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: DefaultCompany 14 | productName: UnityCLI-Example 15 | defaultCursor: {fileID: 0} 16 | cursorHotspot: {x: 0, y: 0} 17 | m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1} 18 | m_ShowUnitySplashScreen: 1 19 | m_ShowUnitySplashLogo: 1 20 | m_SplashScreenOverlayOpacity: 1 21 | m_SplashScreenAnimation: 1 22 | m_SplashScreenLogoStyle: 1 23 | m_SplashScreenDrawMode: 0 24 | m_SplashScreenBackgroundAnimationZoom: 1 25 | m_SplashScreenLogoAnimationZoom: 1 26 | m_SplashScreenBackgroundLandscapeAspect: 1 27 | m_SplashScreenBackgroundPortraitAspect: 1 28 | m_SplashScreenBackgroundLandscapeUvs: 29 | serializedVersion: 2 30 | x: 0 31 | y: 0 32 | width: 1 33 | height: 1 34 | m_SplashScreenBackgroundPortraitUvs: 35 | serializedVersion: 2 36 | x: 0 37 | y: 0 38 | width: 1 39 | height: 1 40 | m_SplashScreenLogos: [] 41 | m_SplashScreenBackgroundLandscape: {fileID: 0} 42 | m_SplashScreenBackgroundPortrait: {fileID: 0} 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_MobileMTRendering: 0 53 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 54 | iosShowActivityIndicatorOnLoading: -1 55 | androidShowActivityIndicatorOnLoading: -1 56 | tizenShowActivityIndicatorOnLoading: -1 57 | iosAppInBackgroundBehavior: 0 58 | displayResolutionDialog: 1 59 | iosAllowHTTPDownload: 1 60 | allowedAutorotateToPortrait: 1 61 | allowedAutorotateToPortraitUpsideDown: 1 62 | allowedAutorotateToLandscapeRight: 1 63 | allowedAutorotateToLandscapeLeft: 1 64 | useOSAutorotation: 1 65 | use32BitDisplayBuffer: 1 66 | disableDepthAndStencilBuffers: 0 67 | defaultIsFullScreen: 1 68 | defaultIsNativeResolution: 1 69 | runInBackground: 0 70 | captureSingleScreen: 0 71 | muteOtherAudioSources: 0 72 | Prepare IOS For Recording: 0 73 | submitAnalytics: 1 74 | usePlayerLog: 1 75 | bakeCollisionMeshes: 0 76 | forceSingleInstance: 0 77 | resizableWindow: 0 78 | useMacAppStoreValidation: 0 79 | gpuSkinning: 0 80 | graphicsJobs: 0 81 | xboxPIXTextureCapture: 0 82 | xboxEnableAvatar: 0 83 | xboxEnableKinect: 0 84 | xboxEnableKinectAutoTracking: 0 85 | xboxEnableFitness: 0 86 | visibleInBackground: 0 87 | allowFullscreenSwitch: 1 88 | graphicsJobMode: 0 89 | macFullscreenMode: 2 90 | d3d9FullscreenMode: 1 91 | d3d11FullscreenMode: 1 92 | xboxSpeechDB: 0 93 | xboxEnableHeadOrientation: 0 94 | xboxEnableGuest: 0 95 | xboxEnablePIXSampling: 0 96 | n3dsDisableStereoscopicView: 0 97 | n3dsEnableSharedListOpt: 1 98 | n3dsEnableVSync: 0 99 | uiUse16BitDepthBuffer: 0 100 | ignoreAlphaClear: 0 101 | xboxOneResolution: 0 102 | xboxOneMonoLoggingLevel: 0 103 | xboxOneLoggingLevel: 1 104 | videoMemoryForVertexBuffers: 0 105 | psp2PowerMode: 0 106 | psp2AcquireBGM: 1 107 | wiiUTVResolution: 0 108 | wiiUGamePadMSAA: 1 109 | wiiUSupportsNunchuk: 0 110 | wiiUSupportsClassicController: 0 111 | wiiUSupportsBalanceBoard: 0 112 | wiiUSupportsMotionPlus: 0 113 | wiiUSupportsProController: 0 114 | wiiUAllowScreenCapture: 1 115 | wiiUControllerCount: 0 116 | m_SupportedAspectRatios: 117 | 4:3: 1 118 | 5:4: 1 119 | 16:10: 1 120 | 16:9: 1 121 | Others: 1 122 | bundleIdentifier: com.devsisters.UnityCLI 123 | bundleVersion: 1.0 124 | preloadedAssets: [] 125 | metroInputSource: 0 126 | m_HolographicPauseOnTrackingLoss: 1 127 | xboxOneDisableKinectGpuReservation: 0 128 | protectGraphicsMemory: 0 129 | AndroidBundleVersionCode: 1 130 | AndroidMinSdkVersion: 9 131 | AndroidPreferredInstallLocation: 1 132 | aotOptions: 133 | apiCompatibilityLevel: 2 134 | stripEngineCode: 1 135 | iPhoneStrippingLevel: 0 136 | iPhoneScriptCallOptimization: 0 137 | iPhoneBuildNumber: 0 138 | ForceInternetPermission: 0 139 | ForceSDCardPermission: 0 140 | CreateWallpaper: 0 141 | APKExpansionFiles: 0 142 | preloadShaders: 0 143 | StripUnusedMeshComponents: 0 144 | VertexChannelCompressionMask: 145 | serializedVersion: 2 146 | m_Bits: 238 147 | iPhoneSdkVersion: 988 148 | iOSTargetOSVersionString: 149 | tvOSSdkVersion: 0 150 | tvOSRequireExtendedGameController: 0 151 | tvOSTargetOSVersionString: 152 | uIPrerenderedIcon: 0 153 | uIRequiresPersistentWiFi: 0 154 | uIRequiresFullScreen: 1 155 | uIStatusBarHidden: 1 156 | uIExitOnSuspend: 0 157 | uIStatusBarStyle: 0 158 | iPhoneSplashScreen: {fileID: 0} 159 | iPhoneHighResSplashScreen: {fileID: 0} 160 | iPhoneTallHighResSplashScreen: {fileID: 0} 161 | iPhone47inSplashScreen: {fileID: 0} 162 | iPhone55inPortraitSplashScreen: {fileID: 0} 163 | iPhone55inLandscapeSplashScreen: {fileID: 0} 164 | iPadPortraitSplashScreen: {fileID: 0} 165 | iPadHighResPortraitSplashScreen: {fileID: 0} 166 | iPadLandscapeSplashScreen: {fileID: 0} 167 | iPadHighResLandscapeSplashScreen: {fileID: 0} 168 | appleTVSplashScreen: {fileID: 0} 169 | tvOSSmallIconLayers: [] 170 | tvOSLargeIconLayers: [] 171 | tvOSTopShelfImageLayers: [] 172 | tvOSTopShelfImageWideLayers: [] 173 | iOSLaunchScreenType: 0 174 | iOSLaunchScreenPortrait: {fileID: 0} 175 | iOSLaunchScreenLandscape: {fileID: 0} 176 | iOSLaunchScreenBackgroundColor: 177 | serializedVersion: 2 178 | rgba: 0 179 | iOSLaunchScreenFillPct: 100 180 | iOSLaunchScreenSize: 100 181 | iOSLaunchScreenCustomXibPath: 182 | iOSLaunchScreeniPadType: 0 183 | iOSLaunchScreeniPadImage: {fileID: 0} 184 | iOSLaunchScreeniPadBackgroundColor: 185 | serializedVersion: 2 186 | rgba: 0 187 | iOSLaunchScreeniPadFillPct: 100 188 | iOSLaunchScreeniPadSize: 100 189 | iOSLaunchScreeniPadCustomXibPath: 190 | iOSDeviceRequirements: [] 191 | iOSURLSchemes: [] 192 | iOSBackgroundModes: 0 193 | iOSMetalForceHardShadows: 0 194 | appleDeveloperTeamID: 195 | iOSManualSigningProvisioningProfileID: 196 | tvOSManualSigningProvisioningProfileID: 197 | appleEnableAutomaticSigning: 0 198 | AndroidTargetDevice: 0 199 | AndroidSplashScreenScale: 0 200 | androidSplashScreen: {fileID: 0} 201 | AndroidKeystoreName: 202 | AndroidKeyaliasName: 203 | AndroidTVCompatibility: 1 204 | AndroidIsGame: 1 205 | androidEnableBanner: 1 206 | m_AndroidBanners: 207 | - width: 320 208 | height: 180 209 | banner: {fileID: 0} 210 | androidGamepadSupportLevel: 0 211 | resolutionDialogBanner: {fileID: 0} 212 | m_BuildTargetIcons: [] 213 | m_BuildTargetBatching: [] 214 | m_BuildTargetGraphicsAPIs: [] 215 | m_BuildTargetVRSettings: [] 216 | openGLRequireES31: 0 217 | openGLRequireES31AEP: 0 218 | webPlayerTemplate: APPLICATION:Default 219 | m_TemplateCustomTags: {} 220 | wiiUTitleID: 0005000011000000 221 | wiiUGroupID: 00010000 222 | wiiUCommonSaveSize: 4096 223 | wiiUAccountSaveSize: 2048 224 | wiiUOlvAccessKey: 0 225 | wiiUTinCode: 0 226 | wiiUJoinGameId: 0 227 | wiiUJoinGameModeMask: 0000000000000000 228 | wiiUCommonBossSize: 0 229 | wiiUAccountBossSize: 0 230 | wiiUAddOnUniqueIDs: [] 231 | wiiUMainThreadStackSize: 3072 232 | wiiULoaderThreadStackSize: 1024 233 | wiiUSystemHeapSize: 128 234 | wiiUTVStartupScreen: {fileID: 0} 235 | wiiUGamePadStartupScreen: {fileID: 0} 236 | wiiUDrcBufferDisabled: 0 237 | wiiUProfilerLibPath: 238 | actionOnDotNetUnhandledException: 1 239 | enableInternalProfiler: 0 240 | logObjCUncaughtExceptions: 1 241 | enableCrashReportAPI: 0 242 | cameraUsageDescription: 243 | locationUsageDescription: 244 | microphoneUsageDescription: 245 | XboxTitleId: 246 | XboxImageXexPath: 247 | XboxSpaPath: 248 | XboxGenerateSpa: 0 249 | XboxDeployKinectResources: 0 250 | XboxSplashScreen: {fileID: 0} 251 | xboxEnableSpeech: 0 252 | xboxAdditionalTitleMemorySize: 0 253 | xboxDeployKinectHeadOrientation: 0 254 | xboxDeployKinectHeadPosition: 0 255 | ps4NPAgeRating: 12 256 | ps4NPTitleSecret: 257 | ps4NPTrophyPackPath: 258 | ps4ParentalLevel: 1 259 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 260 | ps4Category: 0 261 | ps4MasterVersion: 01.00 262 | ps4AppVersion: 01.00 263 | ps4AppType: 0 264 | ps4ParamSfxPath: 265 | ps4VideoOutPixelFormat: 0 266 | ps4VideoOutInitialWidth: 1920 267 | ps4VideoOutBaseModeInitialWidth: 1920 268 | ps4VideoOutReprojectionRate: 120 269 | ps4PronunciationXMLPath: 270 | ps4PronunciationSIGPath: 271 | ps4BackgroundImagePath: 272 | ps4StartupImagePath: 273 | ps4SaveDataImagePath: 274 | ps4SdkOverride: 275 | ps4BGMPath: 276 | ps4ShareFilePath: 277 | ps4ShareOverlayImagePath: 278 | ps4PrivacyGuardImagePath: 279 | ps4NPtitleDatPath: 280 | ps4RemotePlayKeyAssignment: -1 281 | ps4RemotePlayKeyMappingDir: 282 | ps4PlayTogetherPlayerCount: 0 283 | ps4EnterButtonAssignment: 1 284 | ps4ApplicationParam1: 0 285 | ps4ApplicationParam2: 0 286 | ps4ApplicationParam3: 0 287 | ps4ApplicationParam4: 0 288 | ps4DownloadDataSize: 0 289 | ps4GarlicHeapSize: 2048 290 | ps4ProGarlicHeapSize: 2560 291 | ps4Passcode: PN2qmWqBlQ9wQj99nsQzldVI5ZuGXbEW 292 | ps4UseDebugIl2cppLibs: 0 293 | ps4pnSessions: 1 294 | ps4pnPresence: 1 295 | ps4pnFriends: 1 296 | ps4pnGameCustomData: 1 297 | playerPrefsSupport: 0 298 | restrictedAudioUsageRights: 0 299 | ps4UseResolutionFallback: 0 300 | ps4ReprojectionSupport: 0 301 | ps4UseAudio3dBackend: 0 302 | ps4SocialScreenEnabled: 0 303 | ps4ScriptOptimizationLevel: 3 304 | ps4Audio3dVirtualSpeakerCount: 14 305 | ps4attribCpuUsage: 0 306 | ps4PatchPkgPath: 307 | ps4PatchLatestPkgPath: 308 | ps4PatchChangeinfoPath: 309 | ps4PatchDayOne: 0 310 | ps4attribUserManagement: 0 311 | ps4attribMoveSupport: 0 312 | ps4attrib3DSupport: 0 313 | ps4attribShareSupport: 0 314 | ps4attribExclusiveVR: 0 315 | ps4disableAutoHideSplash: 0 316 | ps4videoRecordingFeaturesUsed: 0 317 | ps4contentSearchFeaturesUsed: 0 318 | ps4attribEyeToEyeDistanceSettingVR: 0 319 | ps4IncludedModules: [] 320 | monoEnv: 321 | psp2Splashimage: {fileID: 0} 322 | psp2NPTrophyPackPath: 323 | psp2NPSupportGBMorGJP: 0 324 | psp2NPAgeRating: 12 325 | psp2NPTitleDatPath: 326 | psp2NPCommsID: 327 | psp2NPCommunicationsID: 328 | psp2NPCommsPassphrase: 329 | psp2NPCommsSig: 330 | psp2ParamSfxPath: 331 | psp2ManualPath: 332 | psp2LiveAreaGatePath: 333 | psp2LiveAreaBackroundPath: 334 | psp2LiveAreaPath: 335 | psp2LiveAreaTrialPath: 336 | psp2PatchChangeInfoPath: 337 | psp2PatchOriginalPackage: 338 | psp2PackagePassword: RK5RhRXdCdG5nG5azdNMK66MuCV6GXi5 339 | psp2KeystoneFile: 340 | psp2MemoryExpansionMode: 0 341 | psp2DRMType: 0 342 | psp2StorageType: 0 343 | psp2MediaCapacity: 0 344 | psp2DLCConfigPath: 345 | psp2ThumbnailPath: 346 | psp2BackgroundPath: 347 | psp2SoundPath: 348 | psp2TrophyCommId: 349 | psp2TrophyPackagePath: 350 | psp2PackagedResourcesPath: 351 | psp2SaveDataQuota: 10240 352 | psp2ParentalLevel: 1 353 | psp2ShortTitle: Not Set 354 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 355 | psp2Category: 0 356 | psp2MasterVersion: 01.00 357 | psp2AppVersion: 01.00 358 | psp2TVBootMode: 0 359 | psp2EnterButtonAssignment: 2 360 | psp2TVDisableEmu: 0 361 | psp2AllowTwitterDialog: 1 362 | psp2Upgradable: 0 363 | psp2HealthWarning: 0 364 | psp2UseLibLocation: 0 365 | psp2InfoBarOnStartup: 0 366 | psp2InfoBarColor: 0 367 | psp2UseDebugIl2cppLibs: 0 368 | psmSplashimage: {fileID: 0} 369 | splashScreenBackgroundSourceLandscape: {fileID: 0} 370 | splashScreenBackgroundSourcePortrait: {fileID: 0} 371 | spritePackerPolicy: 372 | webGLMemorySize: 256 373 | webGLExceptionSupport: 1 374 | webGLDataCaching: 0 375 | webGLDebugSymbols: 0 376 | webGLEmscriptenArgs: 377 | webGLModulesDirectory: 378 | webGLTemplate: APPLICATION:Default 379 | webGLAnalyzeBuildSize: 0 380 | webGLUseEmbeddedResources: 0 381 | webGLUseWasm: 0 382 | webGLCompressionFormat: 1 383 | scriptingDefineSymbols: {} 384 | platformArchitecture: {} 385 | scriptingBackend: {} 386 | incrementalIl2cppBuild: {} 387 | additionalIl2CppArgs: 388 | m_RenderingPath: 1 389 | m_MobileRenderingPath: 1 390 | metroPackageName: UnityCLI-Example 391 | metroPackageVersion: 392 | metroCertificatePath: 393 | metroCertificatePassword: 394 | metroCertificateSubject: 395 | metroCertificateIssuer: 396 | metroCertificateNotAfter: 0000000000000000 397 | metroApplicationDescription: UnityCLI-Example 398 | wsaImages: {} 399 | metroTileShortName: 400 | metroCommandLineArgsFile: 401 | metroTileShowName: 0 402 | metroMediumTileShowName: 0 403 | metroLargeTileShowName: 0 404 | metroWideTileShowName: 0 405 | metroDefaultTileSize: 1 406 | metroTileForegroundText: 2 407 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 408 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 409 | a: 1} 410 | metroSplashScreenUseBackgroundColor: 0 411 | platformCapabilities: {} 412 | metroFTAName: 413 | metroFTAFileTypes: [] 414 | metroProtocolName: 415 | metroCompilationOverrides: 1 416 | tizenProductDescription: 417 | tizenProductURL: 418 | tizenSigningProfileName: 419 | tizenGPSPermissions: 0 420 | tizenMicrophonePermissions: 0 421 | tizenDeploymentTarget: 422 | tizenDeploymentTargetType: -1 423 | tizenMinOSVersion: 1 424 | n3dsUseExtSaveData: 0 425 | n3dsCompressStaticMem: 1 426 | n3dsExtSaveDataNumber: 0x12345 427 | n3dsStackSize: 131072 428 | n3dsTargetPlatform: 2 429 | n3dsRegion: 7 430 | n3dsMediaSize: 0 431 | n3dsLogoStyle: 3 432 | n3dsTitle: GameName 433 | n3dsProductCode: 434 | n3dsApplicationId: 0xFF3FF 435 | stvDeviceAddress: 436 | stvProductDescription: 437 | stvProductAuthor: 438 | stvProductAuthorEmail: 439 | stvProductLink: 440 | stvProductCategory: 0 441 | XboxOneProductId: 442 | XboxOneUpdateKey: 443 | XboxOneSandboxId: 444 | XboxOneContentId: 445 | XboxOneTitleId: 446 | XboxOneSCId: 447 | XboxOneGameOsOverridePath: 448 | XboxOnePackagingOverridePath: 449 | XboxOneAppManifestOverridePath: 450 | XboxOnePackageEncryption: 0 451 | XboxOnePackageUpdateGranularity: 2 452 | XboxOneDescription: 453 | XboxOneLanguage: 454 | - enus 455 | XboxOneCapability: [] 456 | XboxOneGameRating: {} 457 | XboxOneIsContentPackage: 0 458 | XboxOneEnableGPUVariability: 0 459 | XboxOneSockets: {} 460 | XboxOneSplashScreen: {fileID: 0} 461 | XboxOneAllowedProductIds: [] 462 | XboxOnePersistentLocalStorageSize: 0 463 | vrEditorSettings: {} 464 | cloudServicesEnabled: {} 465 | cloudProjectId: 466 | projectName: 467 | organizationId: 468 | cloudEnabled: 0 469 | -------------------------------------------------------------------------------- /example/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.5.2f1 2 | -------------------------------------------------------------------------------- /example/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: Fastest 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 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 3 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 3 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 3 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 3 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 3 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS4: 5 169 | PSM: 5 170 | PSP2: 2 171 | Samsung TV: 2 172 | Standalone: 5 173 | Tizen: 2 174 | Web: 5 175 | WebGL: 3 176 | WiiU: 5 177 | Windows Store Apps: 5 178 | XboxOne: 5 179 | iPhone: 2 180 | tvOS: 5 181 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | CrashReportingSettings: 11 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 12 | m_Enabled: 0 13 | m_CaptureEditorExceptions: 1 14 | UnityPurchasingSettings: 15 | m_Enabled: 0 16 | m_TestMode: 0 17 | UnityAnalyticsSettings: 18 | m_Enabled: 0 19 | m_InitializeOnStartup: 1 20 | m_TestMode: 0 21 | m_TestEventUrl: 22 | m_TestConfigUrl: 23 | UnityAdsSettings: 24 | m_Enabled: 0 25 | m_InitializeOnStartup: 1 26 | m_TestMode: 0 27 | m_EnabledPlatforms: 4294967295 28 | m_IosGameId: 29 | m_AndroidGameId: 30 | -------------------------------------------------------------------------------- /libs/UnityEngine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsisters/UnityCLI/57e6fad15e07e09bacc896ba0ebec47902f31511/libs/UnityEngine.dll -------------------------------------------------------------------------------- /src/Bridge.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace CLI 4 | { 5 | [AddComponentMenu("CLI/CLI.Installer")] 6 | public sealed class Bridge : MonoBehaviour 7 | { 8 | public static Bridge Instance; 9 | 10 | public static Bridge TryInstall(int initialPort, string welcomeMessage) 11 | { 12 | const string name = "CLI (Singleton)"; 13 | 14 | if (Instance != null) return Instance; 15 | 16 | var inst = FindObjectOfType(); 17 | if (inst != null && inst.name == name) 18 | { 19 | Instance = inst; 20 | return Instance; 21 | } 22 | 23 | var singleton = new GameObject(name); 24 | Instance = singleton.AddComponent(); 25 | Instance.InitialPort = initialPort; 26 | Instance.WelcomeMessage = welcomeMessage; 27 | Instance.Init(); 28 | DontDestroyOnLoad(singleton); 29 | return Instance; 30 | } 31 | 32 | public static void Uninstall() 33 | { 34 | if (Instance == null) return; 35 | Destroy(Instance.gameObject); 36 | } 37 | 38 | public int InitialPort = 6670; 39 | public string WelcomeMessage; 40 | private Communicator _communicator; 41 | public IExecuter Executer; 42 | 43 | private void Init() 44 | { 45 | if (_communicator != null) return; 46 | byte[] welcomeMsg = null; 47 | if (WelcomeMessage != null) 48 | welcomeMsg = System.Text.Encoding.UTF8.GetBytes(WelcomeMessage); 49 | _communicator = Communicator.Start( 50 | InitialPort, ExecuteCmd, 51 | welcomeMessage: welcomeMsg); 52 | } 53 | 54 | private void OnDestroy() 55 | { 56 | if (_communicator != null) 57 | _communicator.Stop(); 58 | } 59 | 60 | private void Update() 61 | { 62 | Init(); 63 | _communicator.ProcessJobs(); 64 | } 65 | 66 | private Result ExecuteCmd(Command cmd) 67 | { 68 | if (Executer == null) 69 | return Result.Error("ExecuteCmd is null"); 70 | return Executer.Execute(cmd); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Command.cs: -------------------------------------------------------------------------------- 1 | using Args = System.Collections.Generic.List; 2 | 3 | namespace CLI 4 | { 5 | public sealed class Command 6 | { 7 | public string this[int idx] { get { return Args[idx]; } } 8 | 9 | public readonly string Raw; 10 | public readonly Args Args; 11 | 12 | private Command(string raw, Args args) 13 | { 14 | Raw = raw; 15 | Args = args; 16 | } 17 | 18 | private static char[] _trimTokens = new[] { ' ', '\r', '\n', }; 19 | 20 | public static Command Parse(string raw) 21 | { 22 | var tokens = raw.Split(_trimTokens, 23 | System.StringSplitOptions.RemoveEmptyEntries); 24 | var args = new Args(tokens.Length); 25 | for (var i = 0; i < tokens.Length; ++i) 26 | args.Add(tokens[i].Trim(_trimTokens)); 27 | return new Command(raw, args); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Communicator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using Encoding = System.Text.Encoding; 7 | using UnityEngine; 8 | 9 | namespace CLI 10 | { 11 | public delegate Result ExecuteCmd(Command cmd); 12 | 13 | internal sealed class Communicator 14 | { 15 | private struct Job 16 | { 17 | public readonly NetworkStream Stream; 18 | public readonly string Cmd; 19 | 20 | public Job(NetworkStream stream, string cmd) 21 | { 22 | Stream = stream; 23 | Cmd = cmd; 24 | } 25 | } 26 | 27 | private readonly ExecuteCmd _executeCmd; 28 | private readonly byte[] _welcomeMessage; 29 | 30 | private bool _isRunning; 31 | 32 | private readonly TcpListener _listener; 33 | private Thread _listenerThread; 34 | 35 | private readonly List _streams = new List(); 36 | private readonly List _streamsThread = new List(); 37 | 38 | private readonly List _concurrentJobs = new List(); 39 | private readonly List _tempJobs = new List(); 40 | 41 | 42 | internal static Communicator Start(int port, ExecuteCmd executeCmd, byte[] welcomeMessage = null) 43 | { 44 | var ret = new Communicator(port, executeCmd, welcomeMessage); 45 | ret.Start(); 46 | return ret; 47 | } 48 | 49 | private Communicator(int port, ExecuteCmd executeCmd, byte[] welcomeMessage) 50 | { 51 | _executeCmd = executeCmd; 52 | _welcomeMessage = welcomeMessage; 53 | _listener = new TcpListener(IPAddress.Any, port); 54 | } 55 | 56 | public void Start() 57 | { 58 | if (_isRunning) 59 | { 60 | // something went wrong 61 | return; 62 | } 63 | 64 | _isRunning = true; 65 | _listener.Start(); 66 | _listenerThread = new Thread(Loop); 67 | _listenerThread.Name = "CLI.Communicator.Listerner"; 68 | _listenerThread.Start(); 69 | } 70 | 71 | public void Stop() 72 | { 73 | if (!_isRunning) 74 | { 75 | // something went wrong 76 | return; 77 | } 78 | 79 | _isRunning = false; 80 | 81 | _listener.Stop(); 82 | _listenerThread.Join(); 83 | _listenerThread = null; 84 | 85 | lock (_streams) 86 | { 87 | foreach (var stream in _streams) 88 | { 89 | stream.Close(); 90 | stream.Dispose(); 91 | } 92 | 93 | _streams.Clear(); 94 | } 95 | 96 | lock (_streamsThread) 97 | { 98 | foreach (var t in _streamsThread) 99 | t.Join(); 100 | } 101 | 102 | lock (_concurrentJobs) 103 | _concurrentJobs.Clear(); 104 | } 105 | 106 | private static void WriteBufToStream(NetworkStream stream, byte[] buf) { stream.BeginWrite(buf, 0, buf.Length, null, null); } 107 | private static void WriteStringToStream(NetworkStream stream, string str) { WriteBufToStream(stream, Encoding.ASCII.GetBytes(str)); } 108 | private static void WriteLineToStream(NetworkStream stream, string str) { WriteStringToStream(stream, str + '\n'); } 109 | private static void WriteInputBracket(NetworkStream stream) { WriteStringToStream(stream, "> "); } 110 | 111 | private void Loop() 112 | { 113 | while (_isRunning) 114 | { 115 | var client = LoopAcceptClient(); 116 | if (client == null) break; 117 | 118 | var stream = client.GetStream(); 119 | if (_welcomeMessage != null) 120 | { 121 | WriteBufToStream(stream, _welcomeMessage); 122 | WriteStringToStream(stream, "\n"); 123 | } 124 | WriteInputBracket(stream); 125 | 126 | var streamThread = new Thread(() => AddAndLoopReadStream(stream)); 127 | streamThread.Name = "CLI.Communicator.StreamReader " + client.Client.LocalEndPoint; 128 | lock (_streamsThread) _streamsThread.Add(streamThread); 129 | streamThread.Start(); 130 | } 131 | } 132 | 133 | private TcpClient LoopAcceptClient() 134 | { 135 | while (_isRunning) 136 | { 137 | try 138 | { 139 | var client = _listener.AcceptTcpClient(); 140 | if (client != null) return client; 141 | } 142 | catch (SocketException) 143 | { 144 | return null; 145 | } 146 | catch (ThreadAbortException) 147 | { 148 | return null; 149 | } 150 | catch (Exception e) 151 | { 152 | Debug.LogException(e); 153 | } 154 | } 155 | 156 | return null; 157 | } 158 | 159 | private static char[] _trimTokens = new[] { ' ', '\r', '\n', }; 160 | 161 | private void AddAndLoopReadStream(NetworkStream stream) 162 | { 163 | lock (_streams) 164 | { 165 | if (!_isRunning) return; 166 | _streams.Add(stream); 167 | } 168 | 169 | while (_isRunning) 170 | { 171 | string cmd = null; 172 | try 173 | { 174 | cmd = ReadStreamAll(stream); 175 | if (cmd == null) break; 176 | } 177 | catch (Exception) 178 | { 179 | break; 180 | } 181 | 182 | cmd = cmd.Trim(_trimTokens); 183 | var job = new Job(stream, cmd); 184 | lock (_concurrentJobs) _concurrentJobs.Add(job); 185 | } 186 | 187 | lock (_streams) 188 | _streams.Remove(stream); 189 | } 190 | 191 | private static string ReadStreamAll(NetworkStream stream) 192 | { 193 | int i = 0; 194 | var buf = new byte[128]; 195 | string ret = null; 196 | 197 | while ((i = stream.Read(buf, 0, buf.Length)) != 0) 198 | { 199 | if (ret == null) ret = string.Empty; 200 | ret += Encoding.UTF8.GetString(buf, 0, i); 201 | if (i < buf.Length) break; 202 | } 203 | 204 | return ret; 205 | } 206 | 207 | internal void ProcessJobs() 208 | { 209 | lock (_concurrentJobs) 210 | { 211 | if (_concurrentJobs.Count == 0) return; 212 | _tempJobs.AddRange(_concurrentJobs); 213 | _concurrentJobs.Clear(); 214 | } 215 | 216 | foreach (var job in _tempJobs) 217 | { 218 | var result = ProcessCmd(job.Cmd); 219 | WriteLineToStream(job.Stream, result.ToString()); 220 | WriteInputBracket(job.Stream); 221 | } 222 | _tempJobs.Clear(); 223 | } 224 | 225 | private Result ProcessCmd(string raw) 226 | { 227 | try 228 | { 229 | var cmd = Command.Parse(raw); 230 | return _executeCmd(cmd); 231 | } 232 | catch (Exception e) 233 | { 234 | Debug.LogException(e); 235 | return Result.Error(e.Message); 236 | } 237 | } 238 | } 239 | } -------------------------------------------------------------------------------- /src/Executer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace CLI 6 | { 7 | public sealed class CustomExecuter : IExecuter 8 | { 9 | public Func ExecuteCmd; 10 | 11 | public CustomExecuter() 12 | { 13 | } 14 | 15 | public CustomExecuter(Func executeCmd) 16 | { 17 | ExecuteCmd = executeCmd; 18 | } 19 | 20 | public override Result ExecuteFrom(Command cmd, int argFrom) 21 | { 22 | if (ExecuteCmd == null) return Result.Error("ExecuteCmd is not set yet."); 23 | return ExecuteCmd(cmd, argFrom); 24 | } 25 | } 26 | 27 | // TODO: AttributeTargets.Field | AttributeTargets.Property | 28 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] 29 | public sealed class Bind : Attribute { } 30 | 31 | public sealed class ClassExecuter : IExecuter 32 | { 33 | private readonly Dictionary _delegates 34 | = new Dictionary(); 35 | 36 | public ClassExecuter(Type t) 37 | { 38 | var methods = t.GetMethods(); 39 | foreach (var m in methods) 40 | BindMethod(m); 41 | } 42 | 43 | private void BindMethod(MethodInfo m) 44 | { 45 | var attrs = m.GetCustomAttributes(typeof(Bind), true); 46 | if (attrs == null || attrs.Length == 0) return; 47 | 48 | if (!m.IsStatic) throw new Exception("Binding none static method."); 49 | var returnType = m.ReturnType; 50 | if (returnType != typeof(void) && returnType != typeof(Result)) 51 | throw new Exception("Wrong return type. You should return void or CLI.Result"); 52 | 53 | _delegates.Add(m.Name, m); 54 | } 55 | 56 | public override Result ExecuteFrom(Command cmd, int argFrom) 57 | { 58 | var methodName = cmd.Args[argFrom]; 59 | var m = _delegates[methodName]; 60 | 61 | var argInfos = m.GetParameters(); 62 | var args = new object[argInfos.Length]; 63 | for (var i = 0; i != argInfos.Length; ++i) 64 | { 65 | var argRaw = cmd[argFrom + i + 1]; 66 | var argType = argInfos[i].ParameterType; 67 | args[i] = ParseArg(argRaw, argType); 68 | } 69 | 70 | var ret = m.Invoke(null, args); 71 | if (m.ReturnType == typeof(void)) 72 | return Result.Success(); 73 | return (Result)ret; 74 | } 75 | 76 | private object ParseArg(string arg, Type t) 77 | { 78 | if (t == typeof(string)) 79 | return arg; 80 | if (t == typeof(int)) 81 | return int.Parse(arg); 82 | if (t == typeof(bool)) 83 | return bool.Parse(arg); 84 | if (t == typeof(float)) 85 | return float.Parse(arg); 86 | if (t == typeof(double)) 87 | return double.Parse(arg); 88 | return new Exception("Parsing argument failed: " + arg); 89 | } 90 | } 91 | 92 | public sealed class Executer : IExecuter 93 | { 94 | private readonly Dictionary _executers 95 | = new Dictionary(); 96 | 97 | public Executer Bind(Type t) 98 | { 99 | if (t.IsClass) 100 | { 101 | _executers[t.Name] = new ClassExecuter(t); 102 | } 103 | else 104 | { 105 | throw new Exception("Cannot bind: " + t); 106 | } 107 | 108 | return this; 109 | } 110 | 111 | public override Result ExecuteFrom(Command cmd, int argFrom) 112 | { 113 | return _executers[cmd.Args[argFrom]].ExecuteFrom(cmd, argFrom + 1); 114 | } 115 | } 116 | } -------------------------------------------------------------------------------- /src/IExecuter.cs: -------------------------------------------------------------------------------- 1 | namespace CLI 2 | { 3 | public abstract class IExecuter 4 | { 5 | public Result Execute(Command cmd) { return ExecuteFrom(cmd, 0); } 6 | public abstract Result ExecuteFrom(Command cmd, int argFrom); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/Result.cs: -------------------------------------------------------------------------------- 1 | namespace CLI 2 | { 3 | public struct Result 4 | { 5 | public readonly int Code; 6 | public readonly string Msg; 7 | 8 | public Result(int code, string msg) 9 | { 10 | Code = code; 11 | Msg = msg; 12 | } 13 | 14 | public override string ToString() 15 | { 16 | return "[" + Code + "] " + Msg; 17 | } 18 | 19 | public static Result Success(string msg = "Success") 20 | { 21 | return new Result(0, msg); 22 | } 23 | 24 | public static Result Error(string msg) 25 | { 26 | return new Result(-1, msg); 27 | } 28 | 29 | public static Result InvalidCmd(Command cmd) 30 | { 31 | return Error(cmd.Raw); 32 | } 33 | 34 | public static Result UnknownCmd(Command cmd) 35 | { 36 | var format = "Unknown command: "; 37 | return Error(format + cmd.Raw); 38 | } 39 | } 40 | } --------------------------------------------------------------------------------