├── .editorconfig
├── .gitattributes
├── .gitignore
├── CodeAnalysis.ruleset
├── IncrementalCompiler.sln
├── LICENSE
├── README.md
├── appveyor.yml
├── build.cmd
├── build.fsx
├── core
├── IncrementalCompiler
│ ├── App.config
│ ├── CompileOptions.cs
│ ├── CompileResult.cs
│ ├── Compiler.cs
│ ├── CompilerService.cs
│ ├── CompilerServiceClient.cs
│ ├── CompilerServiceHelper.cs
│ ├── CompilerServiceServer.cs
│ ├── FileTimeList.cs
│ ├── IncrementalCompiler.csproj
│ ├── IncrementalCompiler.xml
│ ├── PlatformHelper.cs
│ ├── Program.Dev.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Settings.cs
│ └── packages.config
├── RoslynCompilerFix
│ ├── App.config
│ ├── CSharpCompilerFix.cs
│ ├── CecilExtensions.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RoslynCompilerFix.csproj
│ └── packages.config
├── RoslynMdbWriter
│ ├── MdbHelper.cs
│ ├── MdbWriter.cs
│ ├── MonoSymbolFile.cs
│ ├── MonoSymbolTable.cs
│ ├── MonoSymbolWriter.cs
│ ├── PclFileAccess.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── README.md
│ ├── RoslynInternalKey.Private.snk
│ ├── RoslynInternalKey.Public.snk
│ ├── RoslynMdbWriter.csproj
│ ├── SourceMethodBuilder.cs
│ ├── UnsafeComStreamWrapper.cs
│ ├── app.config
│ └── packages.config
└── UnityPackage
│ ├── .gitignore
│ ├── Assets
│ ├── Editor.meta
│ └── Editor
│ │ ├── CompilerSettings.cs
│ │ └── CompilerSettings.cs.meta
│ ├── InstallCompiler.bat
│ ├── InstallCompiler.exclude
│ └── 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
│ ├── UnityAdsSettings.asset
│ └── UnityConnectSettings.asset
├── docs
├── Benchmark.md
├── Install.png
├── LogFiles.png
├── SettingsMenu.png
├── SettingsWindow.png
└── UnderTheHood.md
├── extra
├── CompilerPlugin.Unity4
│ ├── CompilerPlugin.Unity4.csproj
│ └── Unity4
│ │ ├── UnityEditor.dll
│ │ └── UnityEngine.dll
├── CompilerPlugin.Unity5
│ ├── CompilerPlugin.Unity5.csproj
│ └── Unity5
│ │ ├── UnityEditor.dll
│ │ └── UnityEngine.dll
├── CompilerPlugin
│ ├── CSharp60SupportActivator.cs
│ ├── CSharpProjectProcessor.cs
│ ├── CustomCSharpCompiler.cs
│ ├── CustomCSharpLanguage.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── readme.txt
├── README.md
└── UniversalCompiler
│ ├── Compilers
│ ├── Compiler.cs
│ ├── Incremental60Compiler.cs
│ ├── Microsoft60Compiler.cs
│ ├── Mono30Compiler.cs
│ ├── Mono50Compiler.cs
│ └── Mono60Compiler.cs
│ ├── Logger.cs
│ ├── Platform.cs
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Settings.cs
│ ├── UniversalCompiler.csproj
│ └── UniversalCompiler.xml
├── samples
├── Basic
│ ├── .gitignore
│ ├── Assets
│ │ ├── Editor.meta
│ │ ├── Scenes.meta
│ │ ├── Scenes
│ │ │ ├── MainScene.unity
│ │ │ └── MainScene.unity.meta
│ │ ├── Scripts.meta
│ │ ├── Scripts
│ │ │ ├── Test01.cs
│ │ │ ├── Test01.cs.meta
│ │ │ ├── Test02.cs
│ │ │ ├── Test02.cs.meta
│ │ │ ├── Test03.cs
│ │ │ ├── Test03.cs.meta
│ │ │ ├── Test04.cs
│ │ │ └── Test04.cs.meta
│ │ ├── gmcs.rsp
│ │ ├── gmcs.rsp.meta
│ │ ├── smcs.rsp
│ │ └── smcs.rsp.meta
│ ├── InstallCompiler.bat
│ └── 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
│ │ ├── UnityAdsSettings.asset
│ │ └── UnityConnectSettings.asset
└── Benchmark
│ ├── .gitignore
│ ├── Assets
│ ├── Editor.meta
│ ├── Editor
│ │ ├── Dummy.meta
│ │ └── Dummy
│ │ │ ├── EditorDummy.cs
│ │ │ └── EditorDummy.cs.meta
│ ├── Plugins.meta
│ ├── Plugins
│ │ ├── Dummy.meta
│ │ ├── Dummy
│ │ │ ├── PluginsDummy.cs
│ │ │ └── PluginsDummy.cs.meta
│ │ ├── Editor.meta
│ │ └── Editor
│ │ │ ├── Dummy.meta
│ │ │ └── Dummy
│ │ │ ├── PluginsEditorDummy.cs
│ │ │ └── PluginsEditorDummy.cs.meta
│ ├── Scenes.meta
│ ├── Scenes
│ │ ├── MainScene.unity
│ │ └── MainScene.unity.meta
│ ├── Scripts.meta
│ └── Scripts
│ │ ├── Dummy.meta
│ │ ├── Dummy
│ │ ├── ScriptsDummy.cs
│ │ └── ScriptsDummy.cs.meta
│ │ ├── MainScene.cs
│ │ └── MainScene.cs.meta
│ ├── InstallCompiler.bat
│ ├── 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
│ ├── UnityAdsSettings.asset
│ └── UnityConnectSettings.asset
│ ├── SourceDelete.bat
│ └── SourcePopulate.py
└── tools
├── nuget
├── NuGet.Config
├── NuGet.targets
├── nuget.exe
└── packages.config
└── pdb2mdb
├── README.md
└── pdb2mdb.exe
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*.{cs, py, fsx}]
4 | indent_style = space
5 | indent_size = 4
6 | trim_trailing_whitespace = true
7 | insert_final_newline = true
8 |
9 | [*.{json, xml}]
10 | indent_style = space
11 | indent_size = 2
12 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # User-specific files
2 | *.suo
3 | *.user
4 | *.userosscache
5 | *.sln.docstates
6 |
7 | # Build results
8 | [Dd]ebug/
9 | [Dd]ebugPublic/
10 | [Rr]elease/
11 | [Rr]eleases/
12 | x64/
13 | x86/
14 | build/
15 | bld/
16 | [Bb]in/
17 | [Oo]bj/
18 |
19 | # Coverity output
20 | cov-int/
21 |
22 | # Visual Studio 2015 cache/options directory
23 | .vs/
24 |
25 | # DNX
26 | project.lock.json
27 | artifacts/
28 |
29 | # Visual Studio profiler
30 | *.psess
31 | *.vsp
32 | *.vspx
33 |
34 | # Visual Studio Code
35 | .vscode
36 |
37 | # Click-Once directory
38 | [Pp]ublish/
39 |
40 | # NuGet Packages
41 | *.nupkg
42 | # The packages folder can be ignored because of Package Restore
43 | **/packages/*
44 | # except build/, which is used as an MSBuild target.
45 | !**/packages/build/
46 | # Uncomment if necessary however generally it will be regenerated when needed
47 | #!**/packages/repositories.config
48 |
49 | # Windows Azure Build Output
50 | csx/
51 | *.build.csdef
52 |
53 | # Windows Store app package directory
54 | AppPackages/
55 |
56 | # Visual Studio cache files
57 | # files ending in .cache can be ignored
58 | *.[Cc]ache
59 | # but keep track of directories ending in .cache
60 | !*.[Cc]ache/
61 |
62 | # Fake
63 | .fake/
64 |
65 | # No APK
66 | *.apk
67 |
68 | # Temporary files
69 | *.bak
70 | *.tmp
71 | *.error
72 |
73 |
--------------------------------------------------------------------------------
/IncrementalCompiler.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IncrementalCompiler", "core\IncrementalCompiler\IncrementalCompiler.csproj", "{44B41B02-CCE7-40BE-8B98-164AEEF1D4B1}"
7 | EndProject
8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{092669A2-567F-4C73-A01E-AEBA2C733994}"
9 | EndProject
10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extra", "Extra", "{A22672B3-D1C4-47C0-AB82-6D22BBB94BBB}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompilerPlugin.Unity4", "extra\CompilerPlugin.Unity4\CompilerPlugin.Unity4.csproj", "{A848498C-64E7-444F-83FD-FCFE42E79E53}"
13 | EndProject
14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompilerPlugin.Unity5", "extra\CompilerPlugin.Unity5\CompilerPlugin.Unity5.csproj", "{67FE81D8-C1BF-4D15-A512-E9E8078DEECF}"
15 | EndProject
16 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalCompiler", "extra\UniversalCompiler\UniversalCompiler.csproj", "{B19F1DAC-FA9A-4749-9E03-1848D29BFCCD}"
17 | EndProject
18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoslynMdbWriter", "core\RoslynMdbWriter\RoslynMdbWriter.csproj", "{286226F3-564D-480A-B6C2-2D207CBFB064}"
19 | EndProject
20 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoslynCompilerFix", "core\RoslynCompilerFix\RoslynCompilerFix.csproj", "{75048769-3DF1-40B6-9F3C-8D5C91501FBC}"
21 | EndProject
22 | Global
23 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
24 | Debug|Any CPU = Debug|Any CPU
25 | Release|Any CPU = Release|Any CPU
26 | EndGlobalSection
27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 | {44B41B02-CCE7-40BE-8B98-164AEEF1D4B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {44B41B02-CCE7-40BE-8B98-164AEEF1D4B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {44B41B02-CCE7-40BE-8B98-164AEEF1D4B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {44B41B02-CCE7-40BE-8B98-164AEEF1D4B1}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {A848498C-64E7-444F-83FD-FCFE42E79E53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {A848498C-64E7-444F-83FD-FCFE42E79E53}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {A848498C-64E7-444F-83FD-FCFE42E79E53}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {A848498C-64E7-444F-83FD-FCFE42E79E53}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {67FE81D8-C1BF-4D15-A512-E9E8078DEECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {67FE81D8-C1BF-4D15-A512-E9E8078DEECF}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {67FE81D8-C1BF-4D15-A512-E9E8078DEECF}.Release|Any CPU.ActiveCfg = Release|Any CPU
39 | {67FE81D8-C1BF-4D15-A512-E9E8078DEECF}.Release|Any CPU.Build.0 = Release|Any CPU
40 | {B19F1DAC-FA9A-4749-9E03-1848D29BFCCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41 | {B19F1DAC-FA9A-4749-9E03-1848D29BFCCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
42 | {B19F1DAC-FA9A-4749-9E03-1848D29BFCCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {B19F1DAC-FA9A-4749-9E03-1848D29BFCCD}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {286226F3-564D-480A-B6C2-2D207CBFB064}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {286226F3-564D-480A-B6C2-2D207CBFB064}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {286226F3-564D-480A-B6C2-2D207CBFB064}.Release|Any CPU.ActiveCfg = Release|Any CPU
47 | {286226F3-564D-480A-B6C2-2D207CBFB064}.Release|Any CPU.Build.0 = Release|Any CPU
48 | {75048769-3DF1-40B6-9F3C-8D5C91501FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {75048769-3DF1-40B6-9F3C-8D5C91501FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {75048769-3DF1-40B6-9F3C-8D5C91501FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {75048769-3DF1-40B6-9F3C-8D5C91501FBC}.Release|Any CPU.Build.0 = Release|Any CPU
52 | EndGlobalSection
53 | GlobalSection(SolutionProperties) = preSolution
54 | HideSolutionNode = FALSE
55 | EndGlobalSection
56 | GlobalSection(NestedProjects) = preSolution
57 | {44B41B02-CCE7-40BE-8B98-164AEEF1D4B1} = {092669A2-567F-4C73-A01E-AEBA2C733994}
58 | {A848498C-64E7-444F-83FD-FCFE42E79E53} = {A22672B3-D1C4-47C0-AB82-6D22BBB94BBB}
59 | {67FE81D8-C1BF-4D15-A512-E9E8078DEECF} = {A22672B3-D1C4-47C0-AB82-6D22BBB94BBB}
60 | {B19F1DAC-FA9A-4749-9E03-1848D29BFCCD} = {A22672B3-D1C4-47C0-AB82-6D22BBB94BBB}
61 | {286226F3-564D-480A-B6C2-2D207CBFB064} = {092669A2-567F-4C73-A01E-AEBA2C733994}
62 | {75048769-3DF1-40B6-9F3C-8D5C91501FBC} = {092669A2-567F-4C73-A01E-AEBA2C733994}
63 | EndGlobalSection
64 | EndGlobal
65 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 SaladLab
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://ci.appveyor.com/project/veblush/unity3d-incrementalcompiler)
2 |
3 | # Unity3D.IncrementalCompiler
4 |
5 | Unity3D Incremental C# Compiler using [Roslyn](https://github.com/dotnet/roslyn).
6 | - You can get faster compilation speed. Because it works as an
7 | [incremental compiler](https://en.wikipedia.org/wiki/Incremental_compiler)
8 | - You can use C# 5 and 6 features.
9 |
10 | This project is at an early development stage.
11 | And still now it can support only windows platform.
12 |
13 | ### Setup
14 |
15 | Unzip [a release zip file](https://github.com/SaladLab/Unity3D.IncrementalCompiler/releases)
16 | to your unity project top-most directory.
17 | (Unblocking zip file before decompressing zip file might be required to
18 | avoid TypeLoadException of Unity-Mono.)
19 |
20 | - When Unity 4.x, use IncrementalCompiler.Unity4.zip
21 | - When Unity 5.x, use IncrementalCompiler.Unity5.zip
22 |
23 | A release zip has a plugin dll which should be put at Editor folder and
24 | a few compiler related files which should be put at Compiler folder.
25 | Following before and after screenshot will helps for understanding install location.
26 |
27 | 
28 |
29 | While an incremental compiler build your scripts, it saves log files to project/Temp
30 | directory. With these log files, you can see how it works.
31 |
32 | 
33 |
34 | ### Configuration
35 |
36 | You can configure how this compiler work by settings window.
37 | Click "Assets/Open C# Compiler Settings..." in UnityEditor.
38 |
39 | 
40 |
41 | Not only settings but you can also check detailed log and information.
42 |
43 | 
44 |
45 | Also you can manually modify a configure file which is located at project/Compiler/[IncrementalCompiler.xml](https://github.com/SaladLab/Unity3D.IncrementalCompiler/blob/master/core/IncrementalCompiler/IncrementalCompiler.xml)
46 |
47 | ### More information
48 |
49 | - [Benchmark](./docs/Benchmark.md)
50 | - [Under the hood](./docs/UnderTheHood.md)
51 |
52 | ### FAQ
53 |
54 | - When incremental compiler is installed, Unity claims something wrong like:
55 | ```
56 | TypeLoadException: Could not load type 'UnityEditor.Modules.CSharpCompiler' from assembly 'UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
57 | UnityEditor.Scripting.ScriptCompilers.CreateCompilerInstance (MonoIsland island, Boolean buildingForEditor, BuildTarget targetPlatform, Boolean runUpdater) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilers.cs:93)
58 | ```
59 | This problem is usually caused by windows file blocking system.
60 | You need to unblock zip file before uncompressing this file.
61 |
62 | ### Related works
63 |
64 | - An integration part between unity3d and incremental compiler is based on
65 | [alexzzzz](https://bitbucket.org/alexzzzz/unity-c-5.0-and-6.0-integration/src)'s works.
66 | - Mono MDB writer for roslyn is based on
67 | [DavidKarlas](https://github.com/DavidKarlas)'s
68 | [work](https://github.com/mono/roslyn/pull/4).
69 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.2.2.{build}
2 | os: Visual Studio 2015
3 | build_script:
4 | - cmd: nuget restore & build.cmd package
5 | test: off
6 |
--------------------------------------------------------------------------------
/build.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | pushd %~dp0
4 |
5 | SET PACKAGEPATH=.\packages\
6 | SET NUGET=.\tools\nuget\NuGet.exe
7 | SET NUGETOPTIONS=-ConfigFile .\tools\nuget\NuGet.Config -OutputDirectory %PACKAGEPATH% -ExcludeVersion
8 |
9 | IF NOT EXIST %PACKAGEPATH%FAKE\Ver_4.52.0 (
10 | RD /S/Q %PACKAGEPATH%FAKE
11 | %NUGET% install FAKE -Version 4.52.0 %NUGETOPTIONS%
12 | COPY NUL %PACKAGEPATH%FAKE\Ver_4.52.0
13 | )
14 |
15 | IF NOT EXIST %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.7 (
16 | RD /S/Q %PACKAGEPATH%FAKE.BuildLib
17 | %NUGET% install FAKE.BuildLib -Version 0.3.7 %NUGETOPTIONS%
18 | COPY NUL %PACKAGEPATH%FAKE.BuildLib\Ver_0.3.7
19 | )
20 |
21 | set encoding=utf-8
22 | "%PACKAGEPATH%FAKE\tools\FAKE.exe" build.fsx %*
23 |
24 | popd
25 |
--------------------------------------------------------------------------------
/build.fsx:
--------------------------------------------------------------------------------
1 | #I @"packages/FAKE/tools"
2 | #I @"packages/FAKE.BuildLib/lib/net451"
3 | #r "FakeLib.dll"
4 | #r "BuildLib.dll"
5 |
6 | open Fake
7 | open BuildLib
8 |
9 | let solution =
10 | initSolution
11 | "./IncrementalCompiler.sln" "Release"
12 | [ ]
13 |
14 | Target "Clean" <| fun _ -> cleanBin
15 |
16 | Target "Restore" <| fun _ -> restoreNugetPackages solution
17 |
18 | Target "Build" <| fun _ -> buildSolution solution
19 |
20 | Target "Package" (fun _ ->
21 | // pack IncrementalCompiler.exe with dependent module dlls to packed one
22 | let ilrepackExe = (getNugetPackage "ILRepack" "2.0.13") @@ "tools" @@ "ILRepack.exe"
23 | Shell.Exec(ilrepackExe,
24 | "/wildcards /out:IncrementalCompiler.packed.exe IncrementalCompiler.exe *.dll",
25 | "./core/IncrementalCompiler/bin/Release") |> ignore
26 | // fix roslyn compiler to work well with UnityVS
27 | Shell.Exec("./core/RoslynCompilerFix/bin/Release/RoslynCompilerFix.exe",
28 | "IncrementalCompiler.packed.exe IncrementalCompiler.packed.fixed.exe",
29 | "./core/IncrementalCompiler/bin/Release") |> ignore
30 | // code signing
31 | if hasBuildParam "sign" then (
32 | let certFile = getBuildParam "sign"
33 | let timeUrl = "http://timestamp.verisign.com/scripts/timstamp.dll"
34 | let exeFile = "./core/IncrementalCompiler/bin/Release/IncrementalCompiler.packed.fixed.exe"
35 | Shell.Exec(@"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\signtool.exe",
36 | sprintf "sign /v /f %s /t %s %s" certFile timeUrl exeFile,
37 | ".") |> ignore
38 | )
39 | // let's make package
40 | for target in ["Unity4"; "Unity5"] do
41 | let targetDir = binDir @@ target
42 | let editorDir = targetDir @@ "Assets" @@ "Editor"
43 | let compilerDir = targetDir @@ "Compiler"
44 | // create dirs
45 | CreateDir targetDir
46 | CreateDir editorDir
47 | CreateDir compilerDir
48 | // copy output files
49 | "./core/IncrementalCompiler/bin/Release/IncrementalCompiler.packed.fixed.exe" |> CopyFile (compilerDir @@ "IncrementalCompiler.exe")
50 | "./core/IncrementalCompiler/IncrementalCompiler.xml" |> CopyFile compilerDir
51 | "./core/UnityPackage/Assets/Editor/CompilerSettings.cs" |> CopyFile editorDir
52 | "./extra/CompilerPlugin." + target + "/bin/Release/Unity.PureCSharpTests.dll" |> CopyFile (editorDir @@ "CompilerPlugin.dll")
53 | "./extra/UniversalCompiler/bin/Release/UniversalCompiler.exe" |> CopyFile compilerDir
54 | "./extra/UniversalCompiler/UniversalCompiler.xml" |> CopyFile compilerDir
55 | "./tools/pdb2mdb/pdb2mdb.exe" |> CopyFile compilerDir
56 | // create zipped packages
57 | !! (targetDir @@ "**") |> Zip targetDir (binDir @@ "IncrementalCompiler." + target + ".zip")
58 | )
59 |
60 | Target "Help" <| fun _ ->
61 | showUsage solution (fun name ->
62 | if name = "package" then Some("Build package", "sign")
63 | else None)
64 |
65 | "Clean"
66 | ==> "Restore"
67 | ==> "Build"
68 | ==> "Package"
69 |
70 | RunTargetOrDefault "Help"
71 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
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 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/CompileOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Runtime.Serialization;
5 | using Microsoft.CodeAnalysis;
6 |
7 | namespace IncrementalCompiler
8 | {
9 | public enum DebugSymbolFileType
10 | {
11 | None,
12 | Pdb,
13 | PdbToMdb,
14 | Mdb
15 | }
16 |
17 | public enum PrebuiltOutputReuseType
18 | {
19 | None,
20 | WhenNoChange,
21 | WhenNoSourceChange
22 | }
23 |
24 | [DataContract]
25 | public class CompileOptions
26 | {
27 | [DataMember] public string WorkDirectory;
28 | [DataMember] public string AssemblyName;
29 | [DataMember] public string Output;
30 | [DataMember] public List Defines = new List();
31 | [DataMember] public List References = new List();
32 | [DataMember] public List Files = new List();
33 | [DataMember] public List NoWarnings = new List();
34 | [DataMember] public List Options = new List();
35 | [DataMember] public DebugSymbolFileType DebugSymbolFile;
36 | [DataMember] public PrebuiltOutputReuseType PrebuiltOutputReuse;
37 |
38 | public void ParseArgument(string[] args)
39 | {
40 | foreach (var arg in args)
41 | {
42 | if (arg.StartsWith("-"))
43 | {
44 | string command;
45 | string value;
46 |
47 | var valueIdx = arg.IndexOf(':');
48 | if (valueIdx != -1)
49 | {
50 | command = arg.Substring(1, valueIdx - 1).ToLower();
51 | value = arg.Substring(valueIdx + 1);
52 | }
53 | else
54 | {
55 | command = arg.Substring(1).ToLower();
56 | value = "";
57 | }
58 |
59 | switch (command)
60 | {
61 | case "r":
62 | case "reference":
63 | References.Add(value.Trim('"'));
64 | break;
65 |
66 | case "define":
67 | Defines.Add(value.Trim());
68 | break;
69 |
70 | case "out":
71 | Output = value.Trim('"');
72 | AssemblyName = Path.GetFileNameWithoutExtension(value);
73 | break;
74 |
75 | case "nowarn":
76 | foreach (var id in value.Split(new char[] { ',', ';', ' ' },
77 | StringSplitOptions.RemoveEmptyEntries))
78 | {
79 | int num;
80 | NoWarnings.Add(int.TryParse(id, out num)
81 | ? string.Format("CS{0:0000}", num)
82 | : id);
83 | }
84 | break;
85 |
86 | default:
87 | Options.Add(arg);
88 | break;
89 | }
90 | }
91 | else if (arg.StartsWith("@"))
92 | {
93 | var subArgs = new List();
94 | foreach (var line in File.ReadAllLines(arg.Substring(1)))
95 | {
96 | subArgs.AddRange(CommandLineParser.SplitCommandLineIntoArguments(line, removeHashComments: true));
97 | }
98 | ParseArgument(subArgs.ToArray());
99 | }
100 | else
101 | {
102 | var path = arg.Trim('"');
103 | if (path.Length > 0)
104 | Files.Add(path);
105 | }
106 | }
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/CompileResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.Serialization;
4 |
5 | namespace IncrementalCompiler
6 | {
7 | [DataContract]
8 | public class CompileResult
9 | {
10 | [DataMember] public bool Succeeded;
11 | [DataMember] public List Warnings = new List();
12 | [DataMember] public List Errors = new List();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/CompilerService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ServiceModel;
4 | using NLog;
5 |
6 | namespace IncrementalCompiler
7 | {
8 | [ServiceContract(Namespace = "https://github.com/SaladLab/Unity3D.IncrementalCompiler")]
9 | public interface ICompilerService
10 | {
11 | [OperationContract]
12 | CompileResult Build(string projectPath, CompileOptions options);
13 | }
14 |
15 | [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, IncludeExceptionDetailInFaults = true)]
16 | public class CompilerService : ICompilerService
17 | {
18 | private Logger _logger = LogManager.GetLogger("CompilerService");
19 | private string _projectPath;
20 | private Dictionary _compilerMap;
21 |
22 | public CompileResult Build(string projectPath, CompileOptions options)
23 | {
24 | _logger.Info("Build(projectPath={0}, output={1})", projectPath, options.Output);
25 |
26 | if (string.IsNullOrEmpty(_projectPath) || _projectPath != projectPath)
27 | {
28 | // create new one
29 | _compilerMap = new Dictionary();
30 | if (string.IsNullOrEmpty(_projectPath) == false)
31 | _logger.Info("Flush old project. (Project={0})", _projectPath);
32 | }
33 |
34 | _projectPath = projectPath;
35 |
36 | Compiler compiler;
37 | if (_compilerMap.TryGetValue(options.Output, out compiler) == false)
38 | {
39 | compiler = new Compiler();
40 | _compilerMap.Add(options.Output, compiler);
41 | _logger.Info("Add new project. (Project={0})", _projectPath);
42 | }
43 |
44 | try
45 | {
46 | return compiler.Build(options);
47 | }
48 | catch (Exception e)
49 | {
50 | _logger.Error(e, "Error in build.");
51 | throw;
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/CompilerServiceClient.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 |
3 | namespace IncrementalCompiler
4 | {
5 | public class CompilerServiceClient
6 | {
7 | public static CompileResult Request(int parentProcessId, string currentPath, CompileOptions options)
8 | {
9 | var address = CompilerServiceHelper.BaseAddress + parentProcessId;
10 | var binding = CompilerServiceHelper.GetBinding();
11 | var ep = new EndpointAddress(address);
12 | var channel = ChannelFactory.CreateChannel(binding, ep);
13 | return channel.Build(currentPath, options);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/CompilerServiceHelper.cs:
--------------------------------------------------------------------------------
1 | using System.ServiceModel;
2 | using System.ServiceModel.Channels;
3 |
4 | namespace IncrementalCompiler
5 | {
6 | public static class CompilerServiceHelper
7 | {
8 | private static string winAddress = "net.pipe://localhost/Unity3D.IncrementalCompiler/";
9 | private static string macAddress = "http://localhost:52000/Unity3D.IncrementalCompiler/";
10 |
11 | public static string BaseAddress
12 | {
13 | get
14 | {
15 | return PlatformHelper.CurrentPlatform == Platform.Mac ? macAddress : winAddress;
16 | }
17 | }
18 |
19 | public static Binding GetBinding()
20 | {
21 | if (PlatformHelper.CurrentPlatform == Platform.Mac)
22 | {
23 | return new BasicHttpBinding(BasicHttpSecurityMode.None)
24 | {
25 | MaxBufferSize = int.MaxValue,
26 | MaxReceivedMessageSize = int.MaxValue
27 | };
28 | }
29 | else
30 | {
31 | return new NetNamedPipeBinding(NetNamedPipeSecurityMode.None)
32 | {
33 | MaxBufferSize = int.MaxValue,
34 | MaxReceivedMessageSize = int.MaxValue
35 | };
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/CompilerServiceServer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.ServiceModel;
4 | using System.Threading;
5 | using NLog;
6 |
7 | namespace IncrementalCompiler
8 | {
9 | public class CompilerServiceServer
10 | {
11 | private static ServiceHost serviceHost;
12 |
13 | public static int Run(Logger logger, int parentProcessId)
14 | {
15 | // get parent process which will be monitored
16 |
17 | Process parentProcess = null;
18 | if (parentProcessId != 0)
19 | {
20 | try
21 | {
22 | parentProcess = Process.GetProcessById(parentProcessId);
23 | }
24 | catch (Exception e)
25 | {
26 | logger.Error(e, "Cannot find parentProcess (Id={0})", parentProcessId);
27 | return 1;
28 | }
29 | }
30 |
31 | // open service
32 |
33 | try
34 | {
35 | var address = CompilerServiceHelper.BaseAddress + parentProcessId;
36 | serviceHost = new ServiceHost(typeof(CompilerService));
37 | var binding = CompilerServiceHelper.GetBinding();
38 | serviceHost.AddServiceEndpoint(typeof(ICompilerService), binding, address);
39 | serviceHost.Open();
40 | }
41 | catch (Exception e)
42 | {
43 | if (serviceHost != null)
44 | {
45 | serviceHost.Close();
46 | }
47 | logger.Error(e, "Service Host got an error");
48 | return 1;
49 | }
50 |
51 | if (parentProcess != null)
52 | {
53 | // WaitForExit returns immediately instead of waiting on Mac so use while loop
54 | if (PlatformHelper.CurrentPlatform == Platform.Mac)
55 | {
56 | while (!parentProcess.HasExited)
57 | {
58 | Thread.Sleep(100);
59 | }
60 | }
61 | else
62 | {
63 | parentProcess.WaitForExit();
64 | }
65 | if (serviceHost != null)
66 | {
67 | serviceHost.Close();
68 | }
69 | logger.Info("Parent process just exited. (PID={0})", parentProcess.Id);
70 | }
71 |
72 | return 0;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/FileTimeList.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 |
6 | namespace IncrementalCompiler
7 | {
8 | public class FileTimeList
9 | {
10 | private List> _files;
11 |
12 | public class Result
13 | {
14 | public List Added;
15 | public List Changed;
16 | public List Removed;
17 |
18 | public bool Empty => Added.Count == 0 && Changed.Count == 0 && Removed.Count == 0;
19 | }
20 |
21 | public Result Update(IEnumerable files)
22 | {
23 | return Update(files.Select(file => Tuple.Create(file, File.GetLastWriteTime(file))));
24 | }
25 |
26 | public Result Update(IEnumerable> files)
27 | {
28 | var oldFiles = _files;
29 | _files = files.OrderBy(file => file.Item1).ToList();
30 |
31 | if (oldFiles == null)
32 | {
33 | return new Result
34 | {
35 | Added = new List(),
36 | Changed = new List(),
37 | Removed = new List(),
38 | };
39 | }
40 |
41 | // get differences
42 |
43 | var added = new List();
44 | var changed = new List();
45 | var removed = new List();
46 |
47 | var i = 0;
48 | var j = 0;
49 | while (i < _files.Count && j < oldFiles.Count)
50 | {
51 | var c = Comparer.Default.Compare(_files[i].Item1, oldFiles[j].Item1);
52 | if (c == 0)
53 | {
54 | if (_files[i].Item2 != oldFiles[j].Item2)
55 | changed.Add(_files[i].Item1);
56 | i += 1;
57 | j += 1;
58 | }
59 | else if (c < 0)
60 | {
61 | added.Add(_files[i].Item1);
62 | i += 1;
63 | }
64 | else
65 | {
66 | removed.Add(oldFiles[j].Item1);
67 | j += 1;
68 | }
69 | }
70 | for (; i < _files.Count; i++)
71 | added.Add(_files[i].Item1);
72 | for (; j < oldFiles.Count; j++)
73 | removed.Add(oldFiles[j].Item1);
74 |
75 | return new Result
76 | {
77 | Added = added,
78 | Changed = changed,
79 | Removed = removed,
80 | };
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/IncrementalCompiler.xml:
--------------------------------------------------------------------------------
1 |
Mdb
WhenNoSourceChange
--------------------------------------------------------------------------------
/core/IncrementalCompiler/PlatformHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace IncrementalCompiler
5 | {
6 | public static class PlatformHelper
7 | {
8 | public static Platform CurrentPlatform
9 | {
10 | get
11 | {
12 | switch (Environment.OSVersion.Platform)
13 | {
14 | case PlatformID.Unix:
15 | // Well, there are chances MacOSX is reported as Unix instead of MacOSX.
16 | // Instead of platform check, we'll do a feature checks (Mac specific root folders)
17 | if (Directory.Exists("/Applications")
18 | & Directory.Exists("/System")
19 | & Directory.Exists("/Users")
20 | & Directory.Exists("/Volumes"))
21 | {
22 | return Platform.Mac;
23 | }
24 | return Platform.Linux;
25 |
26 | case PlatformID.MacOSX:
27 | return Platform.Mac;
28 |
29 | default:
30 | return Platform.Windows;
31 | }
32 | }
33 | }
34 | }
35 |
36 | public enum Platform
37 | {
38 | Windows,
39 | Linux,
40 | Mac
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/Program.Dev.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Threading;
6 | using System.ServiceModel;
7 | using NLog;
8 |
9 | namespace IncrementalCompiler
10 | {
11 | partial class Program
12 | {
13 | private static int RunAsDev(string[] args)
14 | {
15 | SetupLogger("IncrementalCompiler.log", true);
16 |
17 | var workDirectory = args[1];
18 | var reponseFile = args[2];
19 | var settings = Settings.Load() ?? Settings.Default;
20 |
21 | var logger = LogManager.GetLogger("Dev");
22 | logger.Info("Started");
23 |
24 | Directory.SetCurrentDirectory(workDirectory);
25 | var curPath = Directory.GetCurrentDirectory();
26 |
27 | var options = new CompileOptions();
28 | options.ParseArgument(new string[]
29 | {
30 | "-nostdlib+",
31 | "-noconfig",
32 | #if true
33 | // Unity5
34 | "-r:" + @"C:/Program Files/Unity/Editor/Data/Mono/lib/mono/2.0/mscorlib.dll",
35 | "-r:" + @"C:/Program Files/Unity/Editor/Data/Mono/lib/mono/2.0/System.dll",
36 | "-r:" + @"C:/Program Files/Unity/Editor/Data/Mono/lib/mono/2.0/System.Core.dll",
37 | "-r:" + @"C:/Program Files/Unity/Editor/Data/Mono/lib/mono/2.0/System.Xml.dll",
38 | #else
39 | // Unity4
40 | "-r:" + @"C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/2.0/mscorlib.dll",
41 | "-r:" + @"C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/2.0/System.dll",
42 | "-r:" + @"C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/2.0/System.Core.dll",
43 | "-r:" + @"C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/mono/2.0/System.Xml.dll",
44 | #endif
45 | "@Temp/" + reponseFile,
46 | });
47 |
48 | options.WorkDirectory = curPath;
49 | options.References = options.References.Distinct().ToList();
50 | options.Files = options.Files.Distinct().ToList();
51 | options.DebugSymbolFile = settings.DebugSymbolFile;
52 | options.PrebuiltOutputReuse = settings.PrebuiltOutputReuse;
53 |
54 | var parentProcessId = Process.GetCurrentProcess().Id;
55 |
56 | Process serverProcess = null;
57 |
58 | while (true)
59 | {
60 | try
61 | {
62 | var w = new Stopwatch();
63 | w.Start();
64 | Console.WriteLine("Run");
65 |
66 | var result = CompilerServiceClient.Request(parentProcessId, curPath, options);
67 |
68 | w.Stop();
69 |
70 | Console.WriteLine("Done: Succeeded={0}. Duration={1}sec. ", result.Succeeded, w.Elapsed.TotalSeconds);
71 | foreach (var warning in result.Warnings)
72 | Console.WriteLine(warning);
73 | foreach (var error in result.Errors)
74 | Console.WriteLine(error);
75 |
76 | Console.ReadLine();
77 | }
78 | catch (EndpointNotFoundException)
79 | {
80 | if (serverProcess == null)
81 | {
82 | var a = new Thread(() => CompilerServiceServer.Run(logger, parentProcessId));
83 | a.Start();
84 | serverProcess = Process.GetCurrentProcess();
85 | /*
86 | serverProcess = Process.Start(
87 | new ProcessStartInfo
88 | {
89 | FileName = Assembly.GetEntryAssembly().Location,
90 | Arguments = "-server " + parentProcessId,
91 | WindowStyle = ProcessWindowStyle.Hidden
92 | });
93 | */
94 | Thread.Sleep(100);
95 | }
96 | else
97 | {
98 | if (serverProcess.HasExited == false)
99 | Thread.Sleep(100);
100 | else
101 | serverProcess = null;
102 | }
103 | }
104 | catch (Exception e)
105 | {
106 | Console.WriteLine(e);
107 | return 1;
108 | }
109 | }
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Unity3D.IncrementalCompiler")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("SaladLab")]
11 | [assembly: AssemblyProduct("Unity3D.IncrementalCompiler")]
12 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
13 |
14 | // Setting ComVisible to false makes the types in this assembly not visible
15 | // to COM components. If you need to access a type in this assembly from
16 | // COM, set the ComVisible attribute to true on that type.
17 | [assembly: ComVisible(false)]
18 |
19 | // The following GUID is for the ID of the typelib if this project is exposed to COM
20 | [assembly: Guid("44b41b02-cce7-40be-8b98-164aeef1d4b1")]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.2.9")]
33 | [assembly: AssemblyFileVersion("1.2.9")]
34 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Reflection;
4 | using System.Xml.Linq;
5 |
6 | namespace IncrementalCompiler
7 | {
8 | public class Settings
9 | {
10 | public DebugSymbolFileType DebugSymbolFile;
11 | public PrebuiltOutputReuseType PrebuiltOutputReuse;
12 |
13 | public static Settings Default = new Settings
14 | {
15 | DebugSymbolFile = DebugSymbolFileType.Mdb,
16 | PrebuiltOutputReuse = PrebuiltOutputReuseType.WhenNoChange,
17 | };
18 |
19 | public static Settings Load()
20 | {
21 | var fileName = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, ".xml");
22 | if (File.Exists(fileName) == false)
23 | return null;
24 |
25 | using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
26 | {
27 | return Load(stream);
28 | }
29 | }
30 |
31 | public static Settings Load(Stream stream)
32 | {
33 | // To reduce start-up time, do manual parsing instead of using XmlSerializer
34 | var xdoc = XDocument.Load(stream).Element("Settings");
35 | return new Settings
36 | {
37 | DebugSymbolFile = (DebugSymbolFileType)Enum.Parse(typeof(DebugSymbolFileType), xdoc.Element("DebugSymbolFile").Value),
38 | PrebuiltOutputReuse = (PrebuiltOutputReuseType)Enum.Parse(typeof(PrebuiltOutputReuseType), xdoc.Element("PrebuiltOutputReuse").Value),
39 | };
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/core/IncrementalCompiler/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
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 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/core/RoslynCompilerFix/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/RoslynCompilerFix/CecilExtensions.cs:
--------------------------------------------------------------------------------
1 | // Exceprt from Mono.Cecil.Tests
2 |
3 | // Author:
4 | // Jb Evain (jbevain@gmail.com)
5 | //
6 | // Copyright (c) 2008 - 2015 Jb Evain
7 | // Copyright (c) 2008 - 2011 Novell, Inc.
8 | //
9 | // Licensed under the MIT/X11 license.
10 |
11 | using System;
12 | using System.Linq;
13 | using SR = System.Reflection;
14 |
15 | namespace Mono.Cecil
16 | {
17 | public static class Extensions
18 | {
19 | public static MethodDefinition GetMethod(this TypeDefinition self, string name)
20 | {
21 | return self.Methods.Where(m => m.Name == name).First();
22 | }
23 |
24 | public static FieldDefinition GetField(this TypeDefinition self, string name)
25 | {
26 | return self.Fields.Where(f => f.Name == name).First();
27 | }
28 |
29 | public static TypeDefinition ToDefinition(this Type self)
30 | {
31 | var module = ModuleDefinition.ReadModule(self.Module.FullyQualifiedName);
32 | return (TypeDefinition)module.LookupToken(self.MetadataToken);
33 | }
34 |
35 | public static MethodDefinition ToDefinition(this SR.MethodBase method)
36 | {
37 | var declaring_type = method.DeclaringType.ToDefinition();
38 | return (MethodDefinition)declaring_type.Module.LookupToken(method.MetadataToken);
39 | }
40 |
41 | public static FieldDefinition ToDefinition(this SR.FieldInfo field)
42 | {
43 | var declaring_type = field.DeclaringType.ToDefinition();
44 | return (FieldDefinition)declaring_type.Module.LookupToken(field.MetadataToken);
45 | }
46 |
47 | public static TypeReference MakeGenericType(this TypeReference self, params TypeReference[] arguments)
48 | {
49 | if (self.GenericParameters.Count != arguments.Length)
50 | throw new ArgumentException();
51 |
52 | var instance = new GenericInstanceType(self);
53 | foreach (var argument in arguments)
54 | instance.GenericArguments.Add(argument);
55 |
56 | return instance;
57 | }
58 |
59 | public static MethodReference MakeGenericMethod(this MethodReference self, params TypeReference[] arguments)
60 | {
61 | if (self.GenericParameters.Count != arguments.Length)
62 | throw new ArgumentException();
63 |
64 | var instance = new GenericInstanceMethod(self);
65 | foreach (var argument in arguments)
66 | instance.GenericArguments.Add(argument);
67 |
68 | return instance;
69 | }
70 |
71 | public static MethodReference MakeGeneric(this MethodReference self, params TypeReference[] arguments)
72 | {
73 | var reference = new MethodReference(self.Name, self.ReturnType, self.DeclaringType.MakeGenericType(arguments))
74 | {
75 | HasThis = self.HasThis,
76 | ExplicitThis = self.ExplicitThis,
77 | CallingConvention = self.CallingConvention,
78 | };
79 |
80 | foreach (var parameter in self.Parameters)
81 | reference.Parameters.Add(new ParameterDefinition(parameter.ParameterType));
82 |
83 | foreach (var generic_parameter in self.GenericParameters)
84 | reference.GenericParameters.Add(new GenericParameter(generic_parameter.Name, reference));
85 |
86 | return reference;
87 | }
88 |
89 | public static FieldReference MakeGeneric(this FieldReference self, params TypeReference[] arguments)
90 | {
91 | return new FieldReference(self.Name, self.FieldType, self.DeclaringType.MakeGenericType(arguments));
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/core/RoslynCompilerFix/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using Mono.Cecil;
4 |
5 | namespace RoslynCompilerFix
6 | {
7 | internal class Program
8 | {
9 | private static int Main(string[] args)
10 | {
11 | if (args.Length < 2)
12 | {
13 | Console.WriteLine("RoslynCompilerFix orignal-exe new-exe");
14 | return 1;
15 | }
16 |
17 | ProcessDll(args[0], args[1]);
18 | Console.WriteLine("Done!");
19 | return 0;
20 | }
21 |
22 | private static void ProcessDll(string dllPath, string dllPathNew)
23 | {
24 | AssemblyDefinition assemblyDef;
25 |
26 | using (var assemblyStream = new MemoryStream(File.ReadAllBytes(dllPath)))
27 | {
28 | assemblyDef = AssemblyDefinition.ReadAssembly(assemblyStream);
29 | }
30 |
31 | CSharpCompilerFix.Process(assemblyDef);
32 |
33 | using (var assemblyStream = File.Create(dllPathNew))
34 | {
35 | assemblyDef.Write(assemblyStream);
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/core/RoslynCompilerFix/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RoslynCompilerFix")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("SaladLab")]
11 | [assembly: AssemblyProduct("Unity3D.IncrementalCompiler")]
12 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
13 |
14 | // Setting ComVisible to false makes the types in this assembly not visible
15 | // to COM components. If you need to access a type in this assembly from
16 | // COM, set the ComVisible attribute to true on that type.
17 | [assembly: ComVisible(false)]
18 |
19 | // The following GUID is for the ID of the typelib if this project is exposed to COM
20 | [assembly: Guid("75048769-3df1-40b6-9f3c-8d5c91501fbc")]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.2.9")]
33 | [assembly: AssemblyFileVersion("1.2.9")]
34 |
--------------------------------------------------------------------------------
/core/RoslynCompilerFix/RoslynCompilerFix.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {75048769-3DF1-40B6-9F3C-8D5C91501FBC}
8 | Exe
9 | Properties
10 | RoslynCompilerFix
11 | RoslynCompilerFix
12 | v4.6
13 | 512
14 | ..\..\CodeAnalysis.ruleset
15 |
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | true
36 |
37 |
38 |
39 | ..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll
40 | True
41 |
42 |
43 | ..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll
44 | True
45 |
46 |
47 | ..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll
48 | True
49 |
50 |
51 | ..\..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll
52 | True
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
86 |
--------------------------------------------------------------------------------
/core/RoslynCompilerFix/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/MdbHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Threading;
5 | using Microsoft.CodeAnalysis.Emit;
6 | using Microsoft.CodeAnalysis;
7 | using Microsoft.CodeAnalysis.CodeGen;
8 |
9 | namespace Mono.CompilerServices.SymbolWriter
10 | {
11 | public static class MdbHelper
12 | {
13 | public static EmitResult EmitWithMdb(this Compilation compilation, Stream peStream, Stream pdbStream = null,
14 | Stream xmlDocumentationStream = null, Stream win32Resources = null,
15 | IEnumerable manifestResources = null, EmitOptions options = null,
16 | IMethodSymbol debugEntryPoint = null, Stream sourceLinkStream = null,
17 | CancellationToken cancellationToken = default(CancellationToken))
18 | {
19 | if (peStream == null)
20 | {
21 | throw new ArgumentNullException(nameof(peStream));
22 | }
23 |
24 | if (!peStream.CanWrite)
25 | {
26 | throw new ArgumentException(CodeAnalysisResources.StreamMustSupportWrite, nameof(peStream));
27 | }
28 |
29 | if (pdbStream != null && !pdbStream.CanWrite)
30 | {
31 | throw new ArgumentException(CodeAnalysisResources.StreamMustSupportWrite, nameof(pdbStream));
32 | }
33 |
34 | var testData = new CompilationTestData
35 | {
36 | SymWriterFactory = () => new MdbWriter()
37 | };
38 |
39 | return compilation.Emit(
40 | peStream,
41 | pdbStream,
42 | xmlDocumentationStream,
43 | win32Resources,
44 | manifestResources,
45 | options,
46 | debugEntryPoint,
47 | sourceLinkStream,
48 | null,
49 | testData,
50 | cancellationToken);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/PclFileAccess.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.IO;
5 | using System.Reflection;
6 |
7 | namespace Mono.CompilerServices.SymbolWriter
8 | {
9 | internal static class PclFileAccess
10 | {
11 | private static Lazy> lazyFileOpenStreamMethod = new Lazy> (() => {
12 | Type file;
13 | try {
14 | // try contract name first:
15 | file = Type.GetType ("System.IO.File, System.IO.FileStream, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: false);
16 | } catch {
17 | file = null;
18 | }
19 |
20 | if (file == null) {
21 | try {
22 | // try corlib next:
23 | file = typeof(object).GetTypeInfo ().Assembly.GetType ("System.IO.File");
24 | } catch {
25 | file = null;
26 | }
27 | }
28 |
29 | try {
30 | var openRead = file.GetTypeInfo ().GetDeclaredMethod ("OpenRead");
31 | return (Func)openRead.CreateDelegate (typeof(Func));
32 | } catch {
33 | return null;
34 | }
35 | });
36 |
37 | internal static Stream OpenFileStream (string path)
38 | {
39 | var factory = lazyFileOpenStreamMethod.Value;
40 | if (factory == null) {
41 | throw new PlatformNotSupportedException ();
42 | }
43 |
44 | Stream fileStream;
45 | try {
46 | fileStream = factory (path);
47 | } catch (ArgumentException) {
48 | throw;
49 | } catch (IOException e) {
50 | if (e.GetType ().Name == "DirectoryNotFoundException") {
51 | throw new FileNotFoundException (e.Message, path, e);
52 | }
53 |
54 | throw;
55 | } catch (Exception e) {
56 | throw new IOException (e.Message, e);
57 | }
58 |
59 | return fileStream;
60 | }
61 |
62 | private static Lazy> lazyFileCreateStreamMethod = new Lazy> (() => {
63 | Type file;
64 | try {
65 | // try contract name first:
66 | file = Type.GetType ("System.IO.File, System.IO.FileStream, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: false);
67 | } catch {
68 | file = null;
69 | }
70 |
71 | if (file == null) {
72 | try {
73 | // try corlib next:
74 | file = typeof(object).GetTypeInfo ().Assembly.GetType ("System.IO.File");
75 | } catch {
76 | file = null;
77 | }
78 | }
79 |
80 | try {
81 | var openWrite = file.GetTypeInfo ().GetDeclaredMethod ("OpenWrite");
82 | return (Func)openWrite.CreateDelegate (typeof(Func));
83 | } catch {
84 | return null;
85 | }
86 | });
87 |
88 | internal static Stream CreateFileStream (string path)
89 | {
90 | var factory = lazyFileCreateStreamMethod.Value;
91 | if (factory == null) {
92 | throw new PlatformNotSupportedException ();
93 | }
94 |
95 | Stream fileStream;
96 | try {
97 | fileStream = factory (path);
98 | } catch (ArgumentException) {
99 | throw;
100 | } catch (IOException e) {
101 | if (e.GetType ().Name == "DirectoryNotFoundException") {
102 | throw new FileNotFoundException (e.Message, path, e);
103 | }
104 |
105 | throw;
106 | } catch (Exception e) {
107 | throw new IOException (e.Message, e);
108 | }
109 |
110 | return fileStream;
111 | }
112 |
113 | private static Lazy> lazyFileDeleteMethod = new Lazy> (() => {
114 | Type file;
115 | try {
116 | // try contract name first:
117 | file = Type.GetType ("System.IO.File, System.IO.FileStream, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", throwOnError: false);
118 | } catch {
119 | file = null;
120 | }
121 |
122 | if (file == null) {
123 | try {
124 | // try corlib next:
125 | file = typeof(object).GetTypeInfo ().Assembly.GetType ("System.IO.File");
126 | } catch {
127 | file = null;
128 | }
129 | }
130 |
131 | try {
132 | var delete = file.GetTypeInfo ().GetDeclaredMethod ("Delete");
133 | return (Action)delete.CreateDelegate (typeof(Action));
134 | } catch {
135 | return null;
136 | }
137 | });
138 |
139 | internal static void Delete (string path)
140 | {
141 | var factory = lazyFileDeleteMethod.Value;
142 | if (factory == null) {
143 | throw new PlatformNotSupportedException ();
144 | }
145 |
146 | try {
147 | factory (path);
148 | } catch (ArgumentException) {
149 | throw;
150 | } catch (IOException e) {
151 | if (e.GetType ().Name == "DirectoryNotFoundException") {
152 | throw new FileNotFoundException (e.Message, path, e);
153 | }
154 |
155 | throw;
156 | } catch (Exception e) {
157 | throw new IOException (e.Message, e);
158 | }
159 | }
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("RoslynMdbWriter")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("SaladLab")]
11 | [assembly: AssemblyProduct("Unity3D.IncrementalCompiler")]
12 | [assembly: AssemblyCopyright("Copyright © 2016 SaladLab")]
13 |
14 | // Setting ComVisible to false makes the types in this assembly not visible
15 | // to COM components. If you need to access a type in this assembly from
16 | // COM, set the ComVisible attribute to true on that type.
17 | [assembly: ComVisible(false)]
18 |
19 | // The following GUID is for the ID of the typelib if this project is exposed to COM
20 | [assembly: Guid("286226f3-564d-480a-b6c2-2d207cbfb064")]
21 |
22 | // Version information for an assembly consists of the following four values:
23 | //
24 | // Major Version
25 | // Minor Version
26 | // Build Number
27 | // Revision
28 | //
29 | // You can specify all the values or you can default the Build and Revision Numbers
30 | // by using the '*' as shown below:
31 | // [assembly: AssemblyVersion("1.0.*")]
32 | [assembly: AssemblyVersion("1.2.9")]
33 | [assembly: AssemblyFileVersion("1.2.9")]
34 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/README.md:
--------------------------------------------------------------------------------
1 | ## RoslynMdbWriter
2 |
3 | This modules let roslyn to emit an MDB debugging symbol file instead of PDB.
4 | Most of code is based on [DavidKarlas](https://github.com/DavidKarlas)'s
5 | [work](https://github.com/mono/roslyn/pull/4). But some works have been done
6 | for handling changes of Roslyn.
7 |
8 | #### More works done
9 |
10 | - Make this assembly pretend to be a friend of roslyn assemblies to
11 | access internal classes like ISymUnmanagedWriter5.
12 | - Use roslyn internal strong name key.
13 | - Rename assembly to Roslyn.Test.Utilities. (one of friend assemblies of roslyn)
14 | - Add MdbHelper to let pdbStream use MdbWriter.
15 | - Add UnsafeComStreamWrapper to use ComMemoryStream like System.Stream.
16 | - Update field name used for accessing private fields in roslyn classes.
17 | - PdbMetadataWrapper.writer -> PdbMetadataWrapper.\_writer
18 | - MetadataWriter.guidIndex -> MetadataWriter.heaps.\_guids
19 | - Implment dummy MdbWriter.GetDebugInfo instead of returning nothing.
20 | - Make MdbWriter implement IPdbWriter.
21 | - MdbWriter.DefineLocalVariable2 uses addr1 as a local variable index rather than
22 | counting index with nextLocalIndex.
23 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/RoslynInternalKey.Private.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/RoslynMdbWriter/RoslynInternalKey.Private.snk
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/RoslynInternalKey.Public.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/RoslynMdbWriter/RoslynInternalKey.Public.snk
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/SourceMethodBuilder.cs:
--------------------------------------------------------------------------------
1 | //
2 | // SourceMethodBuilder.cs
3 | //
4 | // Authors:
5 | // Martin Baulig (martin@ximian.com)
6 | // Marek Safar (marek.safar@gmail.com)
7 | //
8 | // (C) 2002 Ximian, Inc. http://www.ximian.com
9 | // Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining
12 | // a copy of this software and associated documentation files (the
13 | // "Software"), to deal in the Software without restriction, including
14 | // without limitation the rights to use, copy, modify, merge, publish,
15 | // distribute, sublicense, and/or sell copies of the Software, and to
16 | // permit persons to whom the Software is furnished to do so, subject to
17 | // the following conditions:
18 | //
19 | // The above copyright notice and this permission notice shall be
20 | // included in all copies or substantial portions of the Software.
21 | //
22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 | //
30 |
31 | using System.Collections.Generic;
32 |
33 | namespace Mono.CompilerServices.SymbolWriter
34 | {
35 | public class SourceMethodBuilder
36 | {
37 | List _locals;
38 | List _blocks;
39 | List _scope_vars;
40 | Stack _block_stack;
41 | readonly List method_lines;
42 |
43 | internal ICompileUnit _comp_unit;
44 | readonly int ns_id;
45 | readonly IMethodDef method;
46 |
47 | public SourceMethodBuilder (ICompileUnit comp_unit)
48 | {
49 | this._comp_unit = comp_unit;
50 | method_lines = new List ();
51 | }
52 |
53 | public SourceMethodBuilder (ICompileUnit comp_unit, int ns_id, IMethodDef method)
54 | : this (comp_unit)
55 | {
56 | this.ns_id = ns_id;
57 | this.method = method;
58 | }
59 |
60 | public void MarkSequencePoint (int offset, SourceFileEntry file, int line, int column, bool is_hidden)
61 | {
62 | MarkSequencePoint (offset, file, line, column, -1, -1, is_hidden);
63 | }
64 |
65 | public void MarkSequencePoint (int offset, SourceFileEntry file, int line, int column, int end_line, int end_column, bool is_hidden)
66 | {
67 | int file_idx = file != null ? file.Index : 0;
68 | var lne = new LineNumberEntry (file_idx, line, column, end_line, end_column, offset, is_hidden);
69 |
70 | if (method_lines.Count > 0) {
71 | var prev = method_lines[method_lines.Count - 1];
72 |
73 | //
74 | // Same offset cannot be used for multiple lines
75 | //
76 | if (prev.Offset == offset) {
77 | //
78 | // Use the new location because debugger will adjust
79 | // the breakpoint to next line with sequence point
80 | //
81 | if (LineNumberEntry.LocationComparer.Default.Compare (lne, prev) > 0)
82 | method_lines[method_lines.Count - 1] = lne;
83 |
84 | return;
85 | }
86 | }
87 |
88 | method_lines.Add (lne);
89 | }
90 |
91 | public void StartBlock (CodeBlockEntry.Type type, int start_offset)
92 | {
93 | if (_block_stack == null) {
94 | _block_stack = new Stack ();
95 | }
96 |
97 | if (_blocks == null)
98 | _blocks = new List ();
99 |
100 | int parent = CurrentBlock != null ? CurrentBlock.Index : -1;
101 |
102 | CodeBlockEntry block = new CodeBlockEntry (
103 | _blocks.Count + 1, parent, type, start_offset);
104 |
105 | _block_stack.Push (block);
106 | _blocks.Add (block);
107 | }
108 |
109 | public void EndBlock (int end_offset)
110 | {
111 | CodeBlockEntry block = (CodeBlockEntry) _block_stack.Pop ();
112 | block.Close (end_offset);
113 | }
114 |
115 | public CodeBlockEntry[] Blocks {
116 | get {
117 | if (_blocks == null)
118 | return new CodeBlockEntry [0];
119 |
120 | CodeBlockEntry[] retval = new CodeBlockEntry [_blocks.Count];
121 | _blocks.CopyTo (retval, 0);
122 | return retval;
123 | }
124 | }
125 |
126 | public CodeBlockEntry CurrentBlock {
127 | get {
128 | if ((_block_stack != null) && (_block_stack.Count > 0))
129 | return (CodeBlockEntry) _block_stack.Peek ();
130 | else
131 | return null;
132 | }
133 | }
134 |
135 | public LocalVariableEntry[] Locals {
136 | get {
137 | if (_locals == null)
138 | return new LocalVariableEntry [0];
139 | else {
140 | return _locals.ToArray ();
141 | }
142 | }
143 | }
144 |
145 | public ICompileUnit SourceFile {
146 | get {
147 | return _comp_unit;
148 | }
149 | }
150 |
151 | public void AddLocal (int index, string name)
152 | {
153 | if (_locals == null)
154 | _locals = new List ();
155 | int block_idx = CurrentBlock != null ? CurrentBlock.Index : 0;
156 | _locals.Add (new LocalVariableEntry (index, name, block_idx));
157 | }
158 |
159 | public ScopeVariable[] ScopeVariables {
160 | get {
161 | if (_scope_vars == null)
162 | return new ScopeVariable [0];
163 |
164 | return _scope_vars.ToArray ();
165 | }
166 | }
167 |
168 | public void AddScopeVariable (int scope, int index)
169 | {
170 | if (_scope_vars == null)
171 | _scope_vars = new List ();
172 | _scope_vars.Add (
173 | new ScopeVariable (scope, index));
174 | }
175 |
176 | public void DefineMethod (MonoSymbolFile file)
177 | {
178 | DefineMethod (file, method.Token);
179 | }
180 |
181 | public void DefineMethod (MonoSymbolFile file, int token)
182 | {
183 | MethodEntry entry = new MethodEntry (
184 | file, _comp_unit.Entry, token, ScopeVariables,
185 | Locals, method_lines.ToArray (), Blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id);
186 |
187 | file.AddMethod (entry);
188 | }
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/UnsafeComStreamWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Runtime.InteropServices;
6 | using Roslyn.Utilities;
7 |
8 | namespace Mono.CompilerServices.SymbolWriter
9 | {
10 | internal class UnsafeComStreamWrapper : Stream
11 | {
12 | private static readonly FieldInfo PositionFieldInfo;
13 | private static readonly FieldInfo LengthFieldInfo;
14 |
15 | private readonly IUnsafeComStream _stream;
16 |
17 | public override bool CanRead => true;
18 | public override bool CanSeek => true;
19 | public override bool CanWrite => true;
20 | public override long Length => (int)LengthFieldInfo.GetValue(_stream);
21 | public override long Position
22 | {
23 | get { return (int)PositionFieldInfo.GetValue(_stream); }
24 | set { Seek(value, SeekOrigin.Begin); }
25 | }
26 |
27 | static UnsafeComStreamWrapper()
28 | {
29 | PositionFieldInfo = typeof(ComMemoryStream).GetRuntimeFields().First(f => f.Name == "_position");
30 | LengthFieldInfo = typeof(ComMemoryStream).GetRuntimeFields().First(f => f.Name == "_length");
31 | }
32 |
33 | public UnsafeComStreamWrapper(ComMemoryStream stream)
34 | {
35 | _stream = stream;
36 | }
37 |
38 | public override void Flush()
39 | {
40 | }
41 |
42 | public override long Seek(long offset, SeekOrigin origin)
43 | {
44 | var newPosPtr = Marshal.AllocHGlobal(8);
45 | _stream.Seek(offset, (int)origin, newPosPtr);
46 | var newPos = Marshal.ReadInt64(newPosPtr);
47 | Marshal.FreeHGlobal(newPosPtr);
48 | return newPos;
49 | }
50 |
51 | public override void SetLength(long value)
52 | {
53 | _stream.SetSize(value);
54 | }
55 |
56 | public override int Read(byte[] buffer, int offset, int count)
57 | {
58 | var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
59 | var bufferPtr = pinnedBuffer.AddrOfPinnedObject();
60 | var readPtr = Marshal.AllocHGlobal(8);
61 |
62 | _stream.Read(bufferPtr + offset, count, readPtr);
63 | var read = Marshal.ReadInt64(readPtr);
64 |
65 | pinnedBuffer.Free();
66 | Marshal.FreeHGlobal(readPtr);
67 |
68 | return (int)read;
69 | }
70 |
71 | public override void Write(byte[] buffer, int offset, int count)
72 | {
73 | var pinnedBuffer = GCHandle.Alloc(buffer, GCHandleType.Pinned);
74 | var bufferPtr = pinnedBuffer.AddrOfPinnedObject();
75 | var sizePtr = Marshal.AllocHGlobal(8);
76 |
77 | _stream.Write(bufferPtr + offset, count, sizePtr);
78 |
79 | pinnedBuffer.Free();
80 | Marshal.FreeHGlobal(sizePtr);
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/core/RoslynMdbWriter/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
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 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/core/UnityPackage/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 |
6 | # Autogenerated VS/MD solution and project files
7 | *.csproj
8 | *.unityproj
9 | *.sln
10 | *.suo
11 | *.tmp
12 | *.user
13 | *.userprefs
14 | *.pidb
15 | *.booproj
16 |
17 | # Unity3D generated meta files
18 | *.pidb.meta
19 |
20 | # Unity3D Generated File On Crash Reports
21 | sysinfo.txt
22 |
23 | # UnityPackage
24 | *.unitypackage
25 |
26 | # IncrementalCompiler
27 | /Assets/Editor/CompilerPlugin*
28 | /Compiler/
29 |
--------------------------------------------------------------------------------
/core/UnityPackage/Assets/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c91ec772c834857409f5fbfa10bf6aaf
3 | folderAsset: yes
4 | timeCreated: 1452580252
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/core/UnityPackage/Assets/Editor/CompilerSettings.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 49770a273af34c946bd6281aeead0842
3 | timeCreated: 1452580268
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/core/UnityPackage/InstallCompiler.bat:
--------------------------------------------------------------------------------
1 | XCOPY /S /Y /EXCLUDE:InstallCompiler.exclude ..\..\bin\Unity5\* .
2 | PAUSE.
--------------------------------------------------------------------------------
/core/UnityPackage/InstallCompiler.exclude:
--------------------------------------------------------------------------------
1 | CompilerSettings.cs
2 |
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/AudioManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/ClusterInputManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/DynamicsManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/EditorBuildSettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/EditorSettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/GraphicsSettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/InputManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/NavMeshAreas.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/NetworkManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/Physics2DSettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/ProjectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/ProjectSettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.1f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/QualitySettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/TagManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/TimeManager.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/UnityAdsSettings.asset
--------------------------------------------------------------------------------
/core/UnityPackage/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/core/UnityPackage/ProjectSettings/UnityConnectSettings.asset
--------------------------------------------------------------------------------
/docs/Benchmark.md:
--------------------------------------------------------------------------------
1 | # Benchmark
2 |
3 | ### How to measure
4 |
5 | Benchmark is done with following steps.
6 | 1. Run Unity3D.
7 | 1. Open a target project.
8 | 1. Make unity build scripts by editing one C# source for warming up.
9 | 1. Do previous step again and measure compilation time.
10 | - Edit a script in Assembly-CSharp (not plugins nor editor)
11 | - Compilation time is recorded in UniversalCompiler log.
12 |
13 | ### Test environment
14 |
15 | - CPU: Intel Core i5-4690 (3.50 GHz)
16 | - RAM: 8 GB
17 | - OS: Windows 10 Pro (64 bits)
18 | - SSD: Samsung SSD 840 EVO 1TB
19 | - Unity 5.3.1f1 (Win64)
20 |
21 | ### Target projects
22 |
23 | 1. Generated project whose script size is 1.4 MB (sample/Benchmark)
24 | 1. Generated project whose script size is 6.7 MB (sample/Benchmark)
25 | 1. In-house real project whose script size is 9.4 MB
26 |
27 | ### Tested compiler
28 |
29 | 1. Unity default compiler (Mono3)
30 | 1. C# 6 roslyn compiler (CSC6)
31 | 1. Incremental C# 6 Compiler with "WhenNoChange" configuration (ICS6)
32 | 1. Incremental C# 6 Compiler with default "WhenNoSourceChange" configuration (ICS6@)
33 |
34 | ### Results
35 |
36 | #### Project 1 (Generated project: 1.4 MB)
37 |
38 | This project is generated with `SourcePopulate.py 30 20 200` in ./samples/Benchmark.
39 |
40 | ##### Project size
41 |
42 | | Project | Count | Size |
43 | | :------- | ----: | --------: |
44 | | Plugins | 20 | 122,980 |
45 | | Scripts | 200 | 1,175,260 |
46 | | Editor | 30 | 181,409 |
47 | | Total | 250 | 1,479,649 |
48 |
49 | ##### Compilation time (sec)
50 |
51 | | | Mono3 | CSC6 | ICS6 | ICS6@ |
52 | | :-------- | ----: | ----: | ----: | ----: |
53 | | Scripts | 2.23 | 3.52 | 0.95 | 0.95 |
54 | | Editor | 0.60 | 2.88 | 0.23 | 0.17 |
55 | | Total | 2.83 | 6.40 | 1.18 | 1.12 |
56 | | Total (%) | 100% | 226% | 41% | 39% |
57 |
58 | For small size project, it's hard to get significant benefit.
59 | 2.83 seconds with Mono3 is not bad for work.
60 |
61 | #### Project 2 (Generated project: 6.7 MB)
62 |
63 | This project is generated with `SourcePopulate.py 200 20 1000` in ./samples/Benchmark.
64 |
65 | ##### Project size
66 |
67 | | Project | Count | Size |
68 | | :------- | ----: | --------: |
69 | | Plugins | 20 | 122,980 |
70 | | Scripts | 1,000 | 5,642,460 |
71 | | Editor | 200 | 1,130,519 |
72 | | Total | 1,220 | 6,895,959 |
73 |
74 | ##### Compilation time (sec)
75 |
76 | | | Mono3 | CSC6 | ICS6 | ICS6@ |
77 | | :-------- | ----: | ----: | ----: | ----: |
78 | | Scripts | 22.82 | 4.72 | 2.68 | 2.68 |
79 | | Editor | 1.88 | 3.08 | 0.59 | 0.17 |
80 | | Total | 24.70 | 7.80 | 3.27 | 2.85 |
81 | | Total (%) | 100% | 31% | 13% | 11% |
82 |
83 | After getting mono3 result, compilation time seems to be too long.
84 | Test was repeated several times to make sure but same result.
85 | There should be a corner case for mono compiler.
86 |
87 | #### Project 3 (In-house project: 9.4 MB)
88 |
89 | This project is my company project and not allowed to be open.
90 | But this is a real project and worth sharing result.
91 |
92 | ##### Project size
93 |
94 | | Project | Count | Size |
95 | | :------- | ----: | --------: |
96 | | Plugins | 10 | 158,858 |
97 | | Scripts | 1,377 | 7,509,543 |
98 | | Editor | 223 | 1,967,076 |
99 | | Total | 1,610 | 9,635,477 |
100 |
101 | ##### Compilation time (sec)
102 |
103 | | | Mono3 | CSC6 | ICS6 | ICS6@ |
104 | | :-------- | ----: | ----: | ----: | ----: |
105 | | Scripts | 8.30 | 5.67 | 3.50 | 3.52 |
106 | | Editor | 2.83 | 3.27 | 1.10 | 0.19 |
107 | | Total | 11.13 | 8.94 | 4.60 | 3.71 |
108 | | Total (%) | 100% | 80% | 41% | 33% |
109 |
110 | This result is first place that I consider to make this incremental compiler.
111 | Edit & review workflow doesn't go well with Mono3 compilation time.
112 | Everytime source is modified, I always look hard at loading indicator impatiently.
113 | But incremental compiler with aggresive WhenNoSourceChange gives a way faster compilation
114 | speed and make me happy, still I can feel time fly but bearable.
115 |
--------------------------------------------------------------------------------
/docs/Install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/docs/Install.png
--------------------------------------------------------------------------------
/docs/LogFiles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/docs/LogFiles.png
--------------------------------------------------------------------------------
/docs/SettingsMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/docs/SettingsMenu.png
--------------------------------------------------------------------------------
/docs/SettingsWindow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/docs/SettingsWindow.png
--------------------------------------------------------------------------------
/extra/CompilerPlugin.Unity4/CompilerPlugin.Unity4.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {A848498C-64E7-444F-83FD-FCFE42E79E53}
8 | Library
9 | Properties
10 | Unity.PureCSharpTests
11 | Unity.PureCSharpTests
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;UNITY4
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE;UNITY4
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | Unity4\UnityEditor.dll
41 |
42 |
43 | Unity4\UnityEngine.dll
44 |
45 |
46 |
47 |
48 | CSharp60SupportActivator.cs
49 |
50 |
51 | CSharpProjectProcessor.cs
52 |
53 |
54 | CustomCSharpCompiler.cs
55 |
56 |
57 | CustomCSharpLanguage.cs
58 |
59 |
60 | Properties\AssemblyInfo.cs
61 |
62 |
63 |
64 |
65 |
72 |
--------------------------------------------------------------------------------
/extra/CompilerPlugin.Unity4/Unity4/UnityEditor.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/extra/CompilerPlugin.Unity4/Unity4/UnityEditor.dll
--------------------------------------------------------------------------------
/extra/CompilerPlugin.Unity4/Unity4/UnityEngine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/extra/CompilerPlugin.Unity4/Unity4/UnityEngine.dll
--------------------------------------------------------------------------------
/extra/CompilerPlugin.Unity5/CompilerPlugin.Unity5.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {67FE81D8-C1BF-4D15-A512-E9E8078DEECF}
8 | Library
9 | Properties
10 | Unity.PureCSharpTests
11 | Unity.PureCSharpTests
12 | v3.5
13 | 512
14 |
15 |
16 | true
17 | full
18 | false
19 | bin\Debug\
20 | TRACE;DEBUG;UNITY5
21 | prompt
22 | 4
23 |
24 |
25 | pdbonly
26 | true
27 | bin\Release\
28 | TRACE;UNITY5
29 | prompt
30 | 4
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | Unity5\UnityEditor.dll
41 |
42 |
43 | Unity5\UnityEngine.dll
44 |
45 |
46 |
47 |
48 |
49 | CSharp60SupportActivator.cs
50 |
51 |
52 | CSharpProjectProcessor.cs
53 |
54 |
55 | CustomCSharpCompiler.cs
56 |
57 |
58 | CustomCSharpLanguage.cs
59 |
60 |
61 | Properties\AssemblyInfo.cs
62 |
63 |
64 |
65 |
72 |
--------------------------------------------------------------------------------
/extra/CompilerPlugin.Unity5/Unity5/UnityEditor.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/extra/CompilerPlugin.Unity5/Unity5/UnityEditor.dll
--------------------------------------------------------------------------------
/extra/CompilerPlugin.Unity5/Unity5/UnityEngine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/extra/CompilerPlugin.Unity5/Unity5/UnityEngine.dll
--------------------------------------------------------------------------------
/extra/CompilerPlugin/CSharp60SupportActivator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Reflection;
3 | using UnityEditor;
4 | using UnityEditor.Scripting;
5 | using UnityEditor.Scripting.Compilers;
6 |
7 | [InitializeOnLoad]
8 | public static class CSharp60SupportActivator
9 | {
10 | static CSharp60SupportActivator()
11 | {
12 | var list = GetSupportedLanguages();
13 | list.RemoveAll(language => language is CSharpLanguage);
14 | list.Add(new CustomCSharpLanguage());
15 | }
16 |
17 | private static List GetSupportedLanguages()
18 | {
19 | var fieldInfo = typeof(ScriptCompilers).GetField("_supportedLanguages", BindingFlags.NonPublic | BindingFlags.Static);
20 | var languages = (List)fieldInfo.GetValue(null);
21 | return languages;
22 | }
23 | }
--------------------------------------------------------------------------------
/extra/CompilerPlugin/CSharpProjectProcessor.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Linq;
3 | using UnityEditor;
4 |
5 | public class CSharpProjectProcessor : AssetPostprocessor
6 | {
7 | private static bool OnPreGeneratingCSProjectFiles()
8 | {
9 | var currentDirectory = Directory.GetCurrentDirectory();
10 | var projectFiles = Directory.GetFiles(currentDirectory, "*.csproj");
11 |
12 | foreach (var file in projectFiles)
13 | {
14 | UpdateProjectFile(file);
15 | }
16 |
17 | return false;
18 | }
19 |
20 | private static void UpdateProjectFile(string file)
21 | {
22 | // strip out `LangVersion` elements
23 | var lines = File.ReadAllLines(file);
24 | var newLines = lines.Where(line => line.Contains("") == false).ToArray();
25 | if (lines.Count() != newLines.Count())
26 | File.WriteAllLines(file, newLines);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/extra/CompilerPlugin/CustomCSharpCompiler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Reflection;
5 | using UnityEditor;
6 | using UnityEditor.Scripting;
7 | using UnityEditor.Scripting.Compilers;
8 | using UnityEditor.Utils;
9 | using UnityEngine;
10 |
11 | internal class CustomCSharpCompiler : MonoCSharpCompiler
12 | {
13 | #if UNITY4
14 | public CustomCSharpCompiler(MonoIsland island, bool runUpdater) : base(island)
15 | {
16 | }
17 | #else
18 | public CustomCSharpCompiler(MonoIsland island, bool runUpdater) : base(island, runUpdater)
19 | {
20 | }
21 | #endif
22 |
23 | private string[] GetAdditionalReferences()
24 | {
25 | // calling base method via reflection
26 | var bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;
27 | var methodInfo = GetType().BaseType.GetMethod(nameof(GetAdditionalReferences), bindingFlags);
28 | var result = (string[])methodInfo.Invoke(this, null);
29 | return result;
30 | }
31 |
32 | private string GetCompilerPath(List arguments)
33 | {
34 | // calling base method via reflection
35 | var bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;
36 | var methodInfo = GetType().BaseType.GetMethod(nameof(GetCompilerPath), bindingFlags);
37 | var result = (string)methodInfo.Invoke(this, new object[] {arguments});
38 | return result;
39 | }
40 |
41 | private string GetUniversalCompilerPath()
42 | {
43 | var basePath = Path.Combine(Directory.GetCurrentDirectory(), "Compiler");
44 | var compilerPath = Path.Combine(basePath, "UniversalCompiler.exe");
45 | return File.Exists(compilerPath) ? compilerPath : null;
46 | }
47 |
48 | // Copy of MonoCSharpCompiler.StartCompiler()
49 | // The only reason it exists is to call the new implementation
50 | // of GetCompilerPath(...) which is non-virtual unfortunately.
51 | protected override Program StartCompiler()
52 | {
53 | var arguments = new List
54 | {
55 | "-debug",
56 | "-target:library",
57 | "-nowarn:0169",
58 | "-out:" + PrepareFileName(_island._output),
59 | "-unsafe"
60 | };
61 | foreach (var reference in _island._references)
62 | {
63 | arguments.Add("-r:" + PrepareFileName(reference));
64 | }
65 |
66 | foreach (var define in _island._defines.Distinct())
67 | {
68 | arguments.Add("-define:" + define);
69 | }
70 |
71 | foreach (var file in _island._files)
72 | {
73 | arguments.Add(PrepareFileName(file));
74 | }
75 |
76 | var additionalReferences = GetAdditionalReferences();
77 | foreach (string path in additionalReferences)
78 | {
79 | var text = Path.Combine(GetProfileDirectoryViaReflection(), path);
80 | if (File.Exists(text))
81 | {
82 | arguments.Add("-r:" + PrepareFileName(text));
83 | }
84 | }
85 |
86 | var universalCompilerPath = GetUniversalCompilerPath();
87 | if (universalCompilerPath != null)
88 | {
89 | // use universal compiler.
90 | arguments.Add("-define:__UNITY_PROCESSID__" + System.Diagnostics.Process.GetCurrentProcess().Id);
91 |
92 | // this function should be run because it addes an item to arguments
93 | var compilerPath = GetCompilerPath(arguments);
94 |
95 | var rspFileName = "Assets/mcs.rsp";
96 | if (File.Exists(rspFileName))
97 | {
98 | arguments.Add("@" + rspFileName);
99 | }
100 | else
101 | {
102 | var defaultCompilerName = Path.GetFileNameWithoutExtension(compilerPath);
103 | rspFileName = "Assets/" + defaultCompilerName + ".rsp";
104 | if (File.Exists(rspFileName))
105 | arguments.Add("@" + rspFileName);
106 | }
107 |
108 | return StartCompiler(_island._target, universalCompilerPath, arguments);
109 | }
110 | else
111 | {
112 | // fallback to the default compiler.
113 | Debug.LogWarning($"Universal C# compiler not found in project directory. Use the default compiler");
114 | return base.StartCompiler();
115 | }
116 | }
117 |
118 | // In Unity 5.5 and earlier GetProfileDirectory() was an instance method of MonoScriptCompilerBase class.
119 | // In Unity 5.6 the method is removed and the profile directory is detected differently.
120 | private string GetProfileDirectoryViaReflection()
121 | {
122 | var monoScriptCompilerBaseType = typeof(MonoScriptCompilerBase);
123 | var getProfileDirectoryMethodInfo = monoScriptCompilerBaseType.GetMethod("GetProfileDirectory", BindingFlags.NonPublic | BindingFlags.Instance);
124 | if (getProfileDirectoryMethodInfo != null)
125 | {
126 | // For any Unity version prior to 5.6
127 | string result = (string)getProfileDirectoryMethodInfo.Invoke(this, null);
128 | return result;
129 | }
130 |
131 | // For Unity 5.6
132 | var monoIslandType = typeof(MonoIsland);
133 | var apiCompatibilityLevelFieldInfo = monoIslandType.GetField("_api_compatibility_level");
134 | var apiCompatibilityLevel = (ApiCompatibilityLevel)apiCompatibilityLevelFieldInfo.GetValue(_island);
135 |
136 | string profile;
137 | if (apiCompatibilityLevel != ApiCompatibilityLevel.NET_2_0)
138 | {
139 | profile = GetMonoProfileLibDirectory(apiCompatibilityLevel);
140 | }
141 | else
142 | {
143 | profile = "2.0-api";
144 | }
145 |
146 | string profileDirectory = GetProfileDirectory(profile, "MonoBleedingEdge");
147 | return profileDirectory;
148 | }
149 |
150 | private static string GetMonoProfileLibDirectory(ApiCompatibilityLevel apiCompatibilityLevel)
151 | {
152 | var buildPipelineType = typeof(BuildPipeline);
153 | var compatibilityProfileToClassLibFolderMethodInfo = buildPipelineType.GetMethod("CompatibilityProfileToClassLibFolder", BindingFlags.NonPublic | BindingFlags.Static);
154 | string profile = (string)compatibilityProfileToClassLibFolderMethodInfo.Invoke(null, new object[] { apiCompatibilityLevel });
155 |
156 | var apiCompatibilityLevelNet46 = (ApiCompatibilityLevel)3;
157 | string monoInstallation = apiCompatibilityLevel != apiCompatibilityLevelNet46 ? "Mono" : "MonoBleedingEdge";
158 | return GetProfileDirectory(profile, monoInstallation);
159 | }
160 |
161 | private static string GetProfileDirectory(string profile, string monoInstallation)
162 | {
163 | string monoInstallation2 = MonoInstallationFinder.GetMonoInstallation(monoInstallation);
164 | return Path.Combine(monoInstallation2, Path.Combine("lib", Path.Combine("mono", profile)));
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/extra/CompilerPlugin/CustomCSharpLanguage.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEditor.Modules;
3 | using UnityEditor.Scripting;
4 | using UnityEditor.Scripting.Compilers;
5 |
6 | internal class CustomCSharpLanguage : CSharpLanguage
7 | {
8 | #if UNITY4
9 | public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform)
10 | {
11 | // This method almost exactly copies CSharpLanguage.CreateCompiler(...)
12 |
13 | if (!buildingForEditor && targetPlatform.ToString().Contains("MetroPlayer") &&
14 | (PlayerSettings.Metro.compilationOverrides == PlayerSettings.MetroCompilationOverrides.UseNetCore ||
15 | (PlayerSettings.Metro.compilationOverrides == PlayerSettings.MetroCompilationOverrides.UseNetCorePartially
16 | && !island._output.Contains("Assembly-CSharp-firstpass.dll"))))
17 | {
18 | return new MicrosoftCSharpCompiler(island);
19 | }
20 | return new CustomCSharpCompiler(island, false); // MonoCSharpCompiler is replaced with CustomCSharpCompiler
21 | }
22 | #else
23 | public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater)
24 | {
25 | // This method almost exactly copies CSharpLanguage.CreateCompiler(...)
26 |
27 | CSharpCompiler cSharpCompiler = GetCSharpCompiler(targetPlatform, buildingForEditor, island._output);
28 | if (cSharpCompiler != CSharpCompiler.Mono)
29 | {
30 | if (cSharpCompiler == CSharpCompiler.Microsoft)
31 | {
32 | return new MicrosoftCSharpCompiler(island, runUpdater);
33 | }
34 | }
35 | return new CustomCSharpCompiler(island, runUpdater); // MonoCSharpCompiler is replaced with CustomCSharpCompiler
36 | }
37 | #endif
38 | }
--------------------------------------------------------------------------------
/extra/CompilerPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | #if UNITY4
8 | [assembly: AssemblyTitle("Universal C# Compiler Plugin for Unity 4")]
9 | #else
10 | [assembly: AssemblyTitle("Universal C# Compiler Plugin for Unity 5")]
11 | #endif
12 | [assembly: AssemblyDescription("")]
13 | [assembly: AssemblyConfiguration("")]
14 | [assembly: AssemblyCompany("SaladLab")]
15 | [assembly: AssemblyProduct("Unity3D.IncrementalCompiler")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("e8330f9b-ba07-4344-9067-c14b1fb76b26")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.2.9")]
36 | [assembly: AssemblyFileVersion("1.2.9")]
37 |
--------------------------------------------------------------------------------
/extra/CompilerPlugin/readme.txt:
--------------------------------------------------------------------------------
1 | WARNING: This project's assembly name must be the one from the list below. Otherwise, it won't have
2 | access to UnityEditor's 'internal' types and their 'internal' members.
3 |
4 |
5 | Possible assembly names:
6 |
7 | Unity.PureCSharpTests
8 | Unity.IntegrationTests
9 | UnityEditor.Graphs
10 | UnityEditor.WP8.Extensions
11 | UnityEditor.Metro.Extensions
12 | UnityEditor.iOS.Extensions
13 | UnityEditor.Xbox360.Extensions
14 | UnityEditor.BB10.Extensions
15 | UnityEditor.Android.Extensions
16 | UnityEditor.Tizen.Extensions
17 | UnityEditor.PS3.Extensions
18 | UnityEditor.SamsungTV.Extensions
19 | UnityEditor.XboxOne.Extensions
20 | UnityEditor.PSP2.Extensions
21 | UnityEditor.PS4.Extensions
22 | UnityEditor.PSM.Extensions
--------------------------------------------------------------------------------
/extra/README.md:
--------------------------------------------------------------------------------
1 | CompilerPlugin and UniversalCompiler is based on
2 | https://bitbucket.org/alexzzzz/unity-c-5.0-and-6.0-integration/src
3 |
4 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Compilers/Compiler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 |
7 | internal abstract class Compiler
8 | {
9 | protected enum ProcessRuntime
10 | {
11 | CLR40,
12 | CLR20,
13 | }
14 |
15 | public abstract string Name { get; }
16 | public virtual bool NeedsPdb2MdbConversion => false;
17 |
18 | protected readonly Logger logger;
19 | protected readonly string compilerPath;
20 | protected readonly string pbd2MdbPath;
21 |
22 | protected readonly List outputLines = new List();
23 | protected readonly List errorLines = new List();
24 |
25 | protected Compiler(Logger logger, string compilerPath, string pbd2MdbPath = null)
26 | {
27 | this.logger = logger;
28 | this.compilerPath = compilerPath;
29 | this.pbd2MdbPath = pbd2MdbPath;
30 | }
31 |
32 | public int Compile(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile)
33 | {
34 | var process = CreateCompilerProcess(platform, monoProfileDir, unityEditorDataDir, responseFile);
35 | process.OutputDataReceived += (sender, e) => outputLines.Add(e.Data);
36 | process.ErrorDataReceived += (sender, e) => errorLines.Add(e.Data);
37 |
38 | logger?.Append($"Process: {process.StartInfo.FileName}");
39 | logger?.Append($"Arguments: {process.StartInfo.Arguments}");
40 |
41 | process.Start();
42 | process.BeginOutputReadLine();
43 | process.BeginErrorReadLine();
44 | process.WaitForExit();
45 | logger?.Append($"Exit code: {process.ExitCode}");
46 |
47 | return process.ExitCode;
48 | }
49 |
50 | public virtual void PrintCompilerOutputAndErrors()
51 | {
52 | var lines = (from line in outputLines
53 | let trimmedLine = line?.Trim()
54 | where string.IsNullOrEmpty(trimmedLine) == false
55 | select trimmedLine).ToList();
56 |
57 | logger?.Append($"- Compiler output ({lines.Count} {(lines.Count == 1 ? "line" : "lines")}):");
58 |
59 | for (int i = 0; i < lines.Count; i++)
60 | {
61 | Console.Out.WriteLine(lines[i]);
62 | logger?.Append($"{i}: {lines[i]}");
63 | }
64 |
65 | lines = (from line in errorLines
66 | let trimmedLine = line?.Trim()
67 | where string.IsNullOrEmpty(trimmedLine) == false
68 | select trimmedLine).ToList();
69 |
70 | logger?.Append("");
71 | logger?.Append($"- Compiler errors ({lines.Count} {(lines.Count == 1 ? "line" : "lines")}):");
72 |
73 | for (int i = 0; i < lines.Count; i++)
74 | {
75 | Console.Error.WriteLine(lines[i]);
76 | logger?.Append($"{i}: {lines[i]}");
77 | }
78 | }
79 |
80 | protected abstract Process CreateCompilerProcess(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile);
81 |
82 | public virtual void ConvertDebugSymbols(Platform platform, string libraryPath, string unityEditorDataDir) { }
83 |
84 | protected static ProcessStartInfo CreateOSDependentStartInfo(Platform platform, ProcessRuntime processRuntime, string processPath, string processArguments,
85 | string unityEditorDataDir)
86 | {
87 | ProcessStartInfo startInfo;
88 |
89 | if (platform == Platform.Windows)
90 | {
91 | switch (processRuntime)
92 | {
93 | case ProcessRuntime.CLR20:
94 | var runtimePath = Path.Combine(unityEditorDataDir, @"Mono/bin/mono.exe");
95 | startInfo = new ProcessStartInfo(runtimePath, $"\"{processPath}\" {processArguments}");
96 | break;
97 |
98 | case ProcessRuntime.CLR40:
99 | startInfo = new ProcessStartInfo(processPath, processArguments);
100 | break;
101 |
102 | default:
103 | throw new ArgumentOutOfRangeException(nameof(processRuntime), processRuntime, null);
104 | }
105 | }
106 | else
107 | {
108 | string runtimePath;
109 | switch (processRuntime)
110 | {
111 | case ProcessRuntime.CLR40:
112 | if (File.Exists("/usr/local/bin/mono"))
113 | {
114 | runtimePath = "/usr/local/bin/mono";
115 | }
116 | else
117 | {
118 | runtimePath = Path.Combine(unityEditorDataDir, "MonoBleedingEdge/bin/mono");
119 | }
120 | break;
121 |
122 | case ProcessRuntime.CLR20:
123 | runtimePath = Path.Combine(unityEditorDataDir, @"Mono/bin/mono");
124 | break;
125 |
126 | default:
127 | throw new ArgumentOutOfRangeException(nameof(processRuntime), processRuntime, null);
128 | }
129 |
130 | startInfo = new ProcessStartInfo(runtimePath, $"\"{processPath}\" {processArguments}");
131 |
132 | if (processRuntime != ProcessRuntime.CLR20)
133 | {
134 | // Since we already are running under old mono runtime, we need to remove
135 | // these variables before launching the different version of the runtime.
136 | var vars = startInfo.EnvironmentVariables;
137 | vars.Remove("MONO_PATH");
138 | vars.Remove("MONO_CFG_DIR");
139 | }
140 | }
141 |
142 | startInfo.RedirectStandardError = true;
143 | startInfo.RedirectStandardOutput = true;
144 | startInfo.UseShellExecute = false;
145 |
146 | return startInfo;
147 | }
148 |
149 | public virtual void PrintPdb2MdbOutputAndErrors()
150 | {
151 | throw new NotSupportedException();
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Compilers/Incremental60Compiler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Linq;
5 |
6 | internal class Incremental60Compiler : Compiler
7 | {
8 | public override string Name => "Incremental C# Compiler 6.0";
9 | public override bool NeedsPdb2MdbConversion => false;
10 |
11 | public Incremental60Compiler(Logger logger, string directory)
12 | : base(logger, Path.Combine(directory, "IncrementalCompiler.exe")) { }
13 |
14 | public static bool IsAvailable(string directory) => File.Exists(Path.Combine(directory, "IncrementalCompiler.exe"));
15 |
16 | protected override Process CreateCompilerProcess(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile)
17 | {
18 | var systemDllPath = Path.Combine(monoProfileDir, "System.dll");
19 | var systemCoreDllPath = Path.Combine(monoProfileDir, "System.Core.dll");
20 | var systemXmlDllPath = Path.Combine(monoProfileDir, "System.Xml.dll");
21 | var mscorlibDllPath = Path.Combine(monoProfileDir, "mscorlib.dll");
22 |
23 | string processArguments = "-nostdlib+ -noconfig "
24 | + $"-r:\"{mscorlibDllPath}\" "
25 | + $"-r:\"{systemDllPath}\" "
26 | + $"-r:\"{systemCoreDllPath}\" "
27 | + $"-r:\"{systemXmlDllPath}\" " + responseFile;
28 |
29 | var process = new Process();
30 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR40, compilerPath, processArguments, unityEditorDataDir);
31 | return process;
32 | }
33 |
34 | public override void ConvertDebugSymbols(Platform platform, string libraryPath, string unityEditorDataDir)
35 | {
36 | outputLines.Clear();
37 |
38 | var process = new Process();
39 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR40, pbd2MdbPath, libraryPath, unityEditorDataDir);
40 | process.OutputDataReceived += (sender, e) => outputLines.Add(e.Data);
41 |
42 | logger?.Append($"Process: {process.StartInfo.FileName}");
43 | logger?.Append($"Arguments: {process.StartInfo.Arguments}");
44 |
45 | process.Start();
46 | process.BeginOutputReadLine();
47 | process.WaitForExit();
48 | logger?.Append($"Exit code: {process.ExitCode}");
49 |
50 | var pdbPath = Path.Combine("Temp", Path.GetFileNameWithoutExtension(libraryPath) + ".pdb");
51 | File.Delete(pdbPath);
52 | }
53 |
54 | public override void PrintPdb2MdbOutputAndErrors()
55 | {
56 | var lines = (from line in outputLines
57 | let trimmedLine = line?.Trim()
58 | where string.IsNullOrEmpty(trimmedLine) == false
59 | select trimmedLine).ToList();
60 |
61 | logger?.Append($"- pdb2mdb.exe output ({lines.Count} {(lines.Count == 1 ? "line" : "lines")}):");
62 |
63 | for (int i = 0; i < lines.Count; i++)
64 | {
65 | Console.Out.WriteLine(lines[i]);
66 | logger?.Append($"{i}: {lines[i]}");
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Compilers/Microsoft60Compiler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Linq;
5 |
6 | internal class Microsoft60Compiler : Compiler
7 | {
8 | public override string Name => "Microsoft C# 6.0";
9 | public override bool NeedsPdb2MdbConversion => true;
10 |
11 | public Microsoft60Compiler(Logger logger, string directory)
12 | : base(logger, Path.Combine(directory, "csc.exe"), Path.Combine(directory, "pdb2mdb.exe")) { }
13 |
14 | public static bool IsAvailable(string directory) => File.Exists(Path.Combine(directory, "csc.exe")) &&
15 | File.Exists(Path.Combine(directory, "pdb2mdb.exe"));
16 |
17 | protected override Process CreateCompilerProcess(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile)
18 | {
19 | var systemDllPath = Path.Combine(monoProfileDir, "System.dll");
20 | var systemCoreDllPath = Path.Combine(monoProfileDir, "System.Core.dll");
21 | var systemXmlDllPath = Path.Combine(monoProfileDir, "System.Xml.dll");
22 | var mscorlibDllPath = Path.Combine(monoProfileDir, "mscorlib.dll");
23 |
24 | string processArguments = "-nostdlib+ -noconfig -nologo "
25 | + $"-r:\"{mscorlibDllPath}\" "
26 | + $"-r:\"{systemDllPath}\" "
27 | + $"-r:\"{systemCoreDllPath}\" "
28 | + $"-r:\"{systemXmlDllPath}\" " + responseFile;
29 |
30 | var process = new Process();
31 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR40, compilerPath, processArguments, unityEditorDataDir);
32 | return process;
33 | }
34 |
35 | public override void ConvertDebugSymbols(Platform platform, string libraryPath, string unityEditorDataDir)
36 | {
37 | outputLines.Clear();
38 |
39 | var process = new Process();
40 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR40, pbd2MdbPath, libraryPath, unityEditorDataDir);
41 | process.OutputDataReceived += (sender, e) => outputLines.Add(e.Data);
42 |
43 | logger?.Append($"Process: {process.StartInfo.FileName}");
44 | logger?.Append($"Arguments: {process.StartInfo.Arguments}");
45 |
46 | process.Start();
47 | process.BeginOutputReadLine();
48 | process.WaitForExit();
49 | logger?.Append($"Exit code: {process.ExitCode}");
50 |
51 | var pdbPath = Path.Combine("Temp", Path.GetFileNameWithoutExtension(libraryPath) + ".pdb");
52 | File.Delete(pdbPath);
53 | }
54 |
55 | public override void PrintCompilerOutputAndErrors()
56 | {
57 | // Microsoft's compiler writes all warnings and errors to the standard output channel,
58 | // so move them to the error channel
59 |
60 | errorLines.AddRange(outputLines);
61 | outputLines.Clear();
62 |
63 | base.PrintCompilerOutputAndErrors();
64 | }
65 |
66 | public override void PrintPdb2MdbOutputAndErrors()
67 | {
68 | var lines = (from line in outputLines
69 | let trimmedLine = line?.Trim()
70 | where string.IsNullOrEmpty(trimmedLine) == false
71 | select trimmedLine).ToList();
72 |
73 | logger?.Append($"- pdb2mdb.exe output ({lines.Count} {(lines.Count == 1 ? "line" : "lines")}):");
74 |
75 | for (int i = 0; i < lines.Count; i++)
76 | {
77 | Console.Out.WriteLine(lines[i]);
78 | logger?.Append($"{i}: {lines[i]}");
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Compilers/Mono30Compiler.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 |
3 | internal class Mono30Compiler : Compiler
4 | {
5 | public Mono30Compiler(Logger logger, string compilerPath) : base(logger, compilerPath, null) { }
6 | public override string Name => "Mono C# 3.0";
7 |
8 | protected override Process CreateCompilerProcess(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile)
9 | {
10 | var process = new Process();
11 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR20, compilerPath, responseFile, unityEditorDataDir);
12 | return process;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Compilers/Mono50Compiler.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 | using System.Linq;
4 |
5 | internal class Mono50Compiler : Compiler
6 | {
7 | public Mono50Compiler(Logger logger, string compilerPath) : base(logger, compilerPath, null) { }
8 | public override string Name => "Mono C# 5.0";
9 |
10 | protected override Process CreateCompilerProcess(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile)
11 | {
12 | var systemCoreDllPath = Path.Combine(monoProfileDir, "System.Core.dll");
13 |
14 | string processArguments;
15 | if (platform == Platform.Windows && GetSdkValue(responseFile) == "2.0")
16 | {
17 | // -sdk:2.0 requires System.Core.dll. but -sdk:unity doesn't.
18 | processArguments = $"-r:\"{systemCoreDllPath}\" {responseFile}";
19 | }
20 | else
21 | {
22 | processArguments = responseFile;
23 | }
24 |
25 | var process = new Process();
26 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR40, compilerPath, processArguments, unityEditorDataDir);
27 | return process;
28 | }
29 |
30 | private string GetSdkValue(string responseFile)
31 | {
32 | var lines = File.ReadAllLines(responseFile.Substring(1));
33 | var sdkArg = lines.FirstOrDefault(line => line.StartsWith("-sdk:"));
34 | return (sdkArg != null) ? sdkArg.Substring(5) : "";
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Compilers/Mono60Compiler.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 |
4 | internal class Mono60Compiler : Compiler
5 | {
6 | public Mono60Compiler(Logger logger, string directory)
7 | : base(logger, Path.Combine(directory, "mcs.exe"), null) { }
8 |
9 | public override string Name => "Mono C# 6.0";
10 |
11 | protected override Process CreateCompilerProcess(Platform platform, string monoProfileDir, string unityEditorDataDir, string responseFile)
12 | {
13 | var systemCoreDllPath = Path.Combine(monoProfileDir, "System.Core.dll");
14 |
15 | string processArguments;
16 | if (platform == Platform.Windows)
17 | {
18 | processArguments = $"-sdk:2 -debug+ -langversion:Default -r:\"{systemCoreDllPath}\" {responseFile}";
19 | }
20 | else
21 | {
22 | processArguments = $"-sdk:2 -debug+ -langversion:Default {responseFile}";
23 | }
24 |
25 | var process = new Process();
26 | process.StartInfo = CreateOSDependentStartInfo(platform, ProcessRuntime.CLR40, compilerPath, processArguments, unityEditorDataDir);
27 | return process;
28 | }
29 |
30 | public static bool IsAvailable(string directory) => File.Exists(Path.Combine(directory, "mcs.exe"));
31 | }
32 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Logger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Text;
4 | using System.Threading;
5 |
6 | internal class Logger : IDisposable
7 | {
8 | private enum LoggingMethod
9 | {
10 | Immediate,
11 | Retained,
12 |
13 | /*
14 | - Immediate
15 | Every message will be written to the log file right away in real time.
16 |
17 | - Retained
18 | All the messages will be retained in a temporary storage and flushed to disk
19 | only when the Logger object is disposed. This solves the log file sharing problem
20 | when Unity launched two compilation processes simultaneously, that can happen and
21 | happens in case of Assembly-CSharp.dll and Assembly-CSharp-Editor-firstpass.dll
22 | as they do not reference one another.
23 | */
24 | }
25 |
26 | private const string LOG_FILENAME = "./Temp/UniversalCompiler.log";
27 | private const int MAXIMUM_FILE_AGE_IN_MINUTES = 5;
28 |
29 | private readonly Mutex mutex;
30 | private readonly LoggingMethod loggingMethod;
31 | private readonly StringBuilder pendingLines;
32 |
33 | public Logger()
34 | {
35 | mutex = new Mutex(true, "smcs");
36 |
37 | if (mutex.WaitOne(0)) // check if no other process is owning the mutex
38 | {
39 | loggingMethod = LoggingMethod.Immediate;
40 | DeleteLogFileIfTooOld();
41 | }
42 | else
43 | {
44 | pendingLines = new StringBuilder();
45 | loggingMethod = LoggingMethod.Retained;
46 | }
47 | }
48 |
49 | public void Dispose()
50 | {
51 | mutex.WaitOne(); // make sure we own the mutex now, so no other process is writing to the file
52 |
53 | if (loggingMethod == LoggingMethod.Retained)
54 | {
55 | DeleteLogFileIfTooOld();
56 | File.AppendAllText(LOG_FILENAME, pendingLines.ToString());
57 | }
58 |
59 | mutex.ReleaseMutex();
60 | }
61 |
62 | private void DeleteLogFileIfTooOld()
63 | {
64 | var lastWriteTime = new FileInfo(LOG_FILENAME).LastWriteTimeUtc;
65 | if (DateTime.UtcNow - lastWriteTime > TimeSpan.FromMinutes(MAXIMUM_FILE_AGE_IN_MINUTES))
66 | {
67 | File.Delete(LOG_FILENAME);
68 | }
69 | }
70 |
71 | public void AppendHeader()
72 | {
73 | var dateTimeString = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
74 | var middleLine = "*" + new string(' ', 78) + "*";
75 | int index = (80 - dateTimeString.Length) / 2;
76 | middleLine = middleLine.Remove(index, dateTimeString.Length).Insert(index, dateTimeString);
77 |
78 | Append(new string('*', 80));
79 | Append(middleLine);
80 | Append(new string('*', 80));
81 | }
82 |
83 | public void Append(string message)
84 | {
85 | if (loggingMethod == LoggingMethod.Immediate)
86 | {
87 | File.AppendAllText(LOG_FILENAME, message + Environment.NewLine);
88 | }
89 | else
90 | {
91 | pendingLines.AppendLine(message);
92 | }
93 | }
94 | }
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Platform.cs:
--------------------------------------------------------------------------------
1 | internal enum Platform
2 | {
3 | Windows,
4 | Linux,
5 | Mac,
6 | }
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("Universal C# Compiler for Unity")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("SaladLab")]
11 | [assembly: AssemblyProduct("Unity3D.IncrementalCompiler")]
12 |
13 | // Setting ComVisible to false makes the types in this assembly not visible
14 | // to COM components. If you need to access a type in this assembly from
15 | // COM, set the ComVisible attribute to true on that type.
16 | [assembly: ComVisible(false)]
17 |
18 | // The following GUID is for the ID of the typelib if this project is exposed to COM
19 | [assembly: Guid("faf6cab7-0c7a-4b64-8662-5bf4944aea8c")]
20 |
21 | // Version information for an assembly consists of the following four values:
22 | //
23 | // Major Version
24 | // Minor Version
25 | // Build Number
26 | // Revision
27 | //
28 | // You can specify all the values or you can default the Build and Revision Numbers
29 | // by using the '*' as shown below:
30 | // [assembly: AssemblyVersion("1.0.*")]
31 | [assembly: AssemblyVersion("1.2.9")]
32 | [assembly: AssemblyFileVersion("1.2.9")]
33 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/Settings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Reflection;
4 | using System.Xml.Linq;
5 |
6 | public enum CompilerType
7 | {
8 | Auto,
9 | Mono3,
10 | Mono5,
11 | Mono6,
12 | Microsoft6,
13 | Incremental6,
14 | }
15 |
16 | public class Settings
17 | {
18 | public CompilerType Compiler;
19 |
20 | public static Settings Default = new Settings
21 | {
22 | Compiler = CompilerType.Auto,
23 | };
24 |
25 | public static Settings Load()
26 | {
27 | var fileName = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, ".xml");
28 | if (File.Exists(fileName) == false)
29 | return null;
30 |
31 | using (var reader = File.OpenText(fileName))
32 | {
33 | return Load(reader);
34 | }
35 | }
36 |
37 | public static Settings Load(TextReader reader)
38 | {
39 | // To reduce start-up time, do manual parsing instead of using XmlSerializer
40 | var xdoc = XDocument.Load(reader).Element("Settings");
41 | return new Settings
42 | {
43 | Compiler = (CompilerType)Enum.Parse(typeof(CompilerType), xdoc.Element("Compiler").Value),
44 | };
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/UniversalCompiler.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {B19F1DAC-FA9A-4749-9E03-1848D29BFCCD}
8 | Exe
9 | Properties
10 | UniversalCompiler
11 | UniversalCompiler
12 | v3.5
13 | 512
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | PreserveNewest
58 |
59 |
60 |
61 |
68 |
--------------------------------------------------------------------------------
/extra/UniversalCompiler/UniversalCompiler.xml:
--------------------------------------------------------------------------------
1 |
Auto
--------------------------------------------------------------------------------
/samples/Basic/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 |
6 | # Autogenerated VS/MD solution and project files
7 | *.csproj
8 | *.unityproj
9 | *.sln
10 | *.suo
11 | *.tmp
12 | *.user
13 | *.userprefs
14 | *.pidb
15 | *.booproj
16 |
17 | # Unity3D generated meta files
18 | *.pidb.meta
19 |
20 | # Unity3D Generated File On Crash Reports
21 | sysinfo.txt
22 |
23 | # UnityPackage
24 | *.unitypackage
25 |
26 | # IncrementalCompiler
27 | /Assets/Editor/Compiler*
28 | /Compiler/
29 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb912548e985fee4c8785409987d7c6d
3 | folderAsset: yes
4 | timeCreated: 1451824287
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 215064bac6821c642b9b1d88934901a0
3 | folderAsset: yes
4 | timeCreated: 1451824305
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scenes/MainScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 01e6aae5f6523274c89184d86d685c67
3 | timeCreated: 1451824311
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: af69b2e2f6c063b43b77a5ab64e02181
3 | folderAsset: yes
4 | timeCreated: 1451824301
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test01.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using UnityEngine;
4 | using UnityEngine.UI;
5 |
6 | public class Test01 : MonoBehaviour
7 | {
8 | void Start()
9 | {
10 | Debug.Log("Test01.Start");
11 | GetComponent().text = "01";
12 |
13 | var temp = GetComponent().text;
14 | StartCoroutine(TestCoroutine(
15 | 10,
16 | n =>
17 | {
18 | return string.Format("<{0}:{1}>", temp, n);
19 | }));
20 | }
21 |
22 | IEnumerator TestCoroutine(int a, Func b)
23 | {
24 | var v = a;
25 | yield return null;
26 | GetComponent().text = v.ToString();
27 | v += 1;
28 | yield return null;
29 | GetComponent().text = b(v);
30 | }
31 |
32 | public void Rerun()
33 | {
34 | Start();
35 | }
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test01.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 295587b529b91e24aa692dcb6d47ea1c
3 | timeCreated: 1451824549
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test02.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.UI;
3 |
4 | public class Test02 : MonoBehaviour
5 | {
6 | void Start()
7 | {
8 | Debug.Log("Test02.Start");
9 | GetComponent().text = "02:" + Test(-1, 3.5f);
10 | }
11 |
12 | string Test(int param_a, float param_b)
13 | {
14 | int local_c = (int)(param_a + param_b);
15 | if (param_a > 0)
16 | {
17 | string local_d = "A+" + local_c + "/" + param_b;
18 | return local_d;
19 | }
20 | else
21 | {
22 | string local_e = "A-" + local_c + "/" + param_b;
23 | return local_e;
24 | }
25 | }
26 |
27 | public void Rerun()
28 | {
29 | Start();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test02.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de82ba63d354a4c41849b2940e1fa27f
3 | timeCreated: 1451824549
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test03.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.UI;
3 |
4 | public class Test03 : MonoBehaviour
5 | {
6 | void Start()
7 | {
8 | Debug.Log("Test03.Start");
9 | GetComponent().text = "03:" + GetStringLength("Compiler");
10 | #if __COMPILER_OPTION_TEST__
11 | GetComponent().text += ":OK";
12 | #endif
13 | }
14 |
15 | int GetStringLength(string str)
16 | {
17 | var len = 0;
18 | unsafe
19 | {
20 | fixed (char* value = str)
21 | {
22 | // calculate length with unsafe pointer.
23 | for (; value[len] != '\0'; len += 1) { }
24 | }
25 | }
26 | return len;
27 | }
28 |
29 | public void Rerun()
30 | {
31 | Start();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test03.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5f83db237e2d6b4f830f9cf414f5386
3 | timeCreated: 1464676217
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test04.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using UnityEngine;
3 |
4 | public class Test04 : MonoBehaviour
5 | {
6 | // warning test
7 |
8 | [SerializeField]
9 | private Hashtable tableSerialized; // CS0649
10 | private Hashtable tableAssigned; // CS0649
11 |
12 | [SerializeField]
13 | private int xSerialized = 1; // CS0414
14 | private int xAssigned = 1; // CS0414
15 |
16 | public void Func(object o, string p)
17 | {
18 | int j; // CS0168
19 | tableSerialized[p] = o;
20 | tableAssigned[p] = o;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/Scripts/Test04.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 57ae34479dbc6764fa72d5e9ed2c1065
3 | timeCreated: 1465212240
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/gmcs.rsp:
--------------------------------------------------------------------------------
1 | -unsafe -define:__COMPILER_OPTION_TEST__
--------------------------------------------------------------------------------
/samples/Basic/Assets/gmcs.rsp.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18a062126679e6a41bec7654a9c6d9c0
3 | timeCreated: 1464676590
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/smcs.rsp:
--------------------------------------------------------------------------------
1 | -unsafe -define:__COMPILER_OPTION_TEST__
2 |
--------------------------------------------------------------------------------
/samples/Basic/Assets/smcs.rsp.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7a76a6cbd660a7f4c881fdc76864fe13
3 | timeCreated: 1464676153
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Basic/InstallCompiler.bat:
--------------------------------------------------------------------------------
1 | XCOPY /S /Y ..\..\bin\Unity5\* .
2 | PAUSE.
--------------------------------------------------------------------------------
/samples/Basic/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 |
--------------------------------------------------------------------------------
/samples/Basic/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 |
--------------------------------------------------------------------------------
/samples/Basic/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: 2
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_SolverIterationCount: 6
13 | m_QueriesHitTriggers: 1
14 | m_EnableAdaptiveForce: 0
15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
16 |
--------------------------------------------------------------------------------
/samples/Basic/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/Scenes/MainScene.unity
10 |
--------------------------------------------------------------------------------
/samples/Basic/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_WebSecurityEmulationEnabled: 0
10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
11 | m_DefaultBehaviorMode: 1
12 | m_SpritePackerMode: 2
13 | m_SpritePackerPaddingPower: 1
14 | m_ProjectGenerationIncludedExtensions:
15 | m_ProjectGenerationRootNamespace:
16 |
--------------------------------------------------------------------------------
/samples/Basic/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: 5
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_LegacyDeferred:
14 | m_Mode: 1
15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
16 | m_AlwaysIncludedShaders:
17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
23 | m_PreloadedShaders: []
24 | m_ShaderSettings:
25 | useScreenSpaceShadows: 1
26 | m_BuildTargetShaderSettings: []
27 | m_LightmapStripping: 0
28 | m_FogStripping: 0
29 | m_LightmapKeepPlain: 1
30 | m_LightmapKeepDirCombined: 1
31 | m_LightmapKeepDirSeparate: 1
32 | m_LightmapKeepDynamicPlain: 1
33 | m_LightmapKeepDynamicDirCombined: 1
34 | m_LightmapKeepDynamicDirSeparate: 1
35 | m_FogKeepLinear: 1
36 | m_FogKeepExp: 1
37 | m_FogKeepExp2: 1
38 |
--------------------------------------------------------------------------------
/samples/Basic/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 |
--------------------------------------------------------------------------------
/samples/Basic/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshAreas:
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 |
--------------------------------------------------------------------------------
/samples/Basic/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 |
--------------------------------------------------------------------------------
/samples/Basic/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_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26 |
--------------------------------------------------------------------------------
/samples/Basic/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.6f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/samples/Basic/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: 2
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: 2
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: 2
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: 0
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: 2
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: 2
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: 2
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 | BlackBerry: 2
168 | GLES Emulation: 5
169 | Nintendo 3DS: 5
170 | PS3: 5
171 | PS4: 5
172 | PSM: 5
173 | PSP2: 2
174 | Samsung TV: 2
175 | Standalone: 5
176 | Tizen: 2
177 | WP8: 5
178 | Web: 5
179 | WebGL: 3
180 | WiiU: 5
181 | Windows Store Apps: 5
182 | XBOX360: 5
183 | XboxOne: 5
184 | iPhone: 2
185 | tvOS: 5
186 |
--------------------------------------------------------------------------------
/samples/Basic/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 |
--------------------------------------------------------------------------------
/samples/Basic/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 |
--------------------------------------------------------------------------------
/samples/Basic/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!292 &1
4 | UnityAdsSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_InitializeOnStartup: 1
8 | m_TestMode: 0
9 | m_EnabledPlatforms: 4294967295
10 | m_IosGameId:
11 | m_AndroidGameId:
12 |
--------------------------------------------------------------------------------
/samples/Basic/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 | UnityPurchasingSettings:
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | UnityAnalyticsSettings:
10 | m_Enabled: 0
11 | m_InitializeOnStartup: 1
12 | m_TestMode: 0
13 | m_TestEventUrl:
14 | m_TestConfigUrl:
15 |
--------------------------------------------------------------------------------
/samples/Benchmark/.gitignore:
--------------------------------------------------------------------------------
1 | /[Ll]ibrary/
2 | /[Tt]emp/
3 | /[Oo]bj/
4 | /[Bb]uild/
5 |
6 | # Autogenerated VS/MD solution and project files
7 | *.csproj
8 | *.unityproj
9 | *.sln
10 | *.suo
11 | *.tmp
12 | *.user
13 | *.userprefs
14 | *.pidb
15 | *.booproj
16 |
17 | # Unity3D generated meta files
18 | *.pidb.meta
19 |
20 | # Unity3D Generated File On Crash Reports
21 | sysinfo.txt
22 |
23 | # UnityPackage
24 | *.unitypackage
25 |
26 | # IncrementalCompiler
27 | /Assets/Editor/Compiler*
28 | /Compiler/
29 |
30 | # Generated Code
31 | X_*.cs
32 | X_*.cs.meta
33 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cffd5dcaf55c8ea41aae4df66addeeec
3 | folderAsset: yes
4 | timeCreated: 1452128592
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Editor/Dummy.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3a5218936aad97b4e8ad65be934a3757
3 | folderAsset: yes
4 | timeCreated: 1452128931
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Editor/Dummy/EditorDummy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Globalization;
5 | using System.Text.RegularExpressions;
6 |
7 | public class EditorDummy
8 | {
9 | // from http://www.dotnetperls.com/word-count
10 |
11 | public static int CountWords1(string s)
12 | {
13 | MatchCollection collection = Regex.Matches(s, @"[\S]+");
14 | return collection.Count;
15 | }
16 |
17 | public static int CountWords2(string s)
18 | {
19 | int c = 0;
20 | for (int i = 1; i < s.Length; i++)
21 | {
22 | if (char.IsWhiteSpace(s[i - 1]) == true)
23 | {
24 | if (char.IsLetterOrDigit(s[i]) == true ||
25 | char.IsPunctuation(s[i]))
26 | {
27 | c++;
28 | }
29 | }
30 | }
31 | if (s.Length > 2)
32 | {
33 | c++;
34 | }
35 | return c;
36 | }
37 |
38 | // from http://www.dotnetperls.com/array-optimization
39 |
40 | const int _max = 100000000;
41 |
42 | public static void ArrayOptimization()
43 | {
44 | int[] array = new int[12];
45 | Method1(array);
46 | Method2(array);
47 |
48 | var s1 = Stopwatch.StartNew();
49 | for (int i = 0; i < _max; i++)
50 | {
51 | Method1(array);
52 | }
53 | s1.Stop();
54 | var s2 = Stopwatch.StartNew();
55 | for (int i = 0; i < _max; i++)
56 | {
57 | Method2(array);
58 | }
59 | s2.Stop();
60 | Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) /
61 | _max).ToString("0.00 ns"));
62 | Console.WriteLine(((double)(s2.Elapsed.TotalMilliseconds * 1000 * 1000) /
63 | _max).ToString("0.00 ns"));
64 | Console.Read();
65 | }
66 |
67 | static void Method1(int[] array)
68 | {
69 | // Initialize each element in for-loop.
70 | for (int i = 0; i < array.Length; i++)
71 | {
72 | array[i] = 1;
73 | }
74 | }
75 |
76 | static void Method2(int[] array)
77 | {
78 | // Initialize each element in separate statement with no enclosing loop.
79 | array[0] = 1;
80 | array[1] = 1;
81 | array[2] = 1;
82 | array[3] = 1;
83 | array[4] = 1;
84 | array[5] = 1;
85 | array[6] = 1;
86 | array[7] = 1;
87 | array[8] = 1;
88 | array[9] = 1;
89 | array[10] = 1;
90 | array[11] = 1;
91 | }
92 |
93 | // from http://www.dotnetperls.com/dictionary
94 |
95 | public static void Dictionary1()
96 | {
97 | // Example Dictionary again.
98 | Dictionary d = new Dictionary()
99 | {
100 | {"cat", 2},
101 | {"dog", 1},
102 | {"llama", 0},
103 | {"iguana", -1}
104 | };
105 | // Loop over pairs with foreach.
106 | foreach (KeyValuePair pair in d)
107 | {
108 | Console.WriteLine("{0}, {1}",
109 | pair.Key,
110 | pair.Value);
111 | }
112 | // Use var keyword to enumerate dictionary.
113 | foreach (var pair in d)
114 | {
115 | Console.WriteLine("{0}, {1}",
116 | pair.Key,
117 | pair.Value);
118 | }
119 | }
120 |
121 | public static void Dictionary2()
122 | {
123 | Dictionary d = new Dictionary()
124 | {
125 | {"cat", 2},
126 | {"dog", 1},
127 | {"llama", 0},
128 | {"iguana", -1}
129 | };
130 | // Store keys in a List
131 | List list = new List(d.Keys);
132 | // Loop through list
133 | foreach (string k in list)
134 | {
135 | Console.WriteLine("{0}, {1}",
136 | k,
137 | d[k]);
138 | }
139 | }
140 |
141 | // from: http://www.dotnetperls.com/format
142 |
143 | public static void Format1()
144 | {
145 | // Declare three variables.
146 | // ... The values they have are not important.
147 | string value1 = "Dot Net Perls";
148 | int value2 = 10000;
149 | DateTime value3 = new DateTime(2015, 11, 1);
150 | // Use string.Format method with four arguments.
151 | // ... The first argument is the formatting string.
152 | // ... It specifies how the next arguments are formatted.
153 | string result = string.Format("{0}: {1:0.0} - {2:yyyy}",
154 | value1,
155 | value2,
156 | value3);
157 | // Write the result.
158 | Console.WriteLine(result);
159 | }
160 |
161 | public static void Format2()
162 | {
163 | // Format a ratio as a percentage string.
164 | // ... You must specify the percentage symbol.
165 | // ... It will multiply the value by 100.
166 | double ratio = 0.73;
167 | string result = string.Format("string = {0:0.0%}",
168 | ratio);
169 | Console.WriteLine(result);
170 | }
171 |
172 | public static void Format3()
173 | {
174 | // The constant formatting string.
175 | // ... It specifies the padding.
176 | // ... A negative number means to left-align.
177 | // ... A positive number means to right-align.
178 | const string format = "{0,-10} {1,10}";
179 | // Construct the strings.
180 | string line1 = string.Format(format,
181 | 100,
182 | 5);
183 | string line2 = string.Format(format,
184 | "Carrot",
185 | "Giraffe");
186 | // Write the formatted strings.
187 | Console.WriteLine(line1);
188 | Console.WriteLine(line2);
189 | }
190 |
191 | public static void Format4()
192 | {
193 | int value1 = 10995;
194 |
195 | // Write number in hex format.
196 | Console.WriteLine("{0:x}", value1);
197 | Console.WriteLine("{0:x8}", value1);
198 |
199 | Console.WriteLine("{0:X}", value1);
200 | Console.WriteLine("{0:X8}", value1);
201 |
202 | // Convert to hex.
203 | string hex = value1.ToString("X8");
204 |
205 | // Convert from hex to integer.
206 | int value2 = int.Parse(hex, NumberStyles.AllowHexSpecifier);
207 | Console.WriteLine(value1 == value2);
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Editor/Dummy/EditorDummy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 17646847028d6834e9061151bf5cb36d
3 | timeCreated: 1452128931
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f4b2aff650628c6478e9604e88915ae1
3 | folderAsset: yes
4 | timeCreated: 1452128931
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Dummy.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 79f404b74f7d35d49985f3220470c1f2
3 | folderAsset: yes
4 | timeCreated: 1452128931
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Dummy/PluginsDummy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Globalization;
5 | using System.Text.RegularExpressions;
6 |
7 | public class PluginsDummy
8 | {
9 | // from http://www.dotnetperls.com/word-count
10 |
11 | public static int CountWords1(string s)
12 | {
13 | MatchCollection collection = Regex.Matches(s, @"[\S]+");
14 | return collection.Count;
15 | }
16 |
17 | public static int CountWords2(string s)
18 | {
19 | int c = 0;
20 | for (int i = 1; i < s.Length; i++)
21 | {
22 | if (char.IsWhiteSpace(s[i - 1]) == true)
23 | {
24 | if (char.IsLetterOrDigit(s[i]) == true ||
25 | char.IsPunctuation(s[i]))
26 | {
27 | c++;
28 | }
29 | }
30 | }
31 | if (s.Length > 2)
32 | {
33 | c++;
34 | }
35 | return c;
36 | }
37 |
38 | // from http://www.dotnetperls.com/array-optimization
39 |
40 | const int _max = 100000000;
41 |
42 | public static void ArrayOptimization()
43 | {
44 | int[] array = new int[12];
45 | Method1(array);
46 | Method2(array);
47 |
48 | var s1 = Stopwatch.StartNew();
49 | for (int i = 0; i < _max; i++)
50 | {
51 | Method1(array);
52 | }
53 | s1.Stop();
54 | var s2 = Stopwatch.StartNew();
55 | for (int i = 0; i < _max; i++)
56 | {
57 | Method2(array);
58 | }
59 | s2.Stop();
60 | Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) /
61 | _max).ToString("0.00 ns"));
62 | Console.WriteLine(((double)(s2.Elapsed.TotalMilliseconds * 1000 * 1000) /
63 | _max).ToString("0.00 ns"));
64 | Console.Read();
65 | }
66 |
67 | static void Method1(int[] array)
68 | {
69 | // Initialize each element in for-loop.
70 | for (int i = 0; i < array.Length; i++)
71 | {
72 | array[i] = 1;
73 | }
74 | }
75 |
76 | static void Method2(int[] array)
77 | {
78 | // Initialize each element in separate statement with no enclosing loop.
79 | array[0] = 1;
80 | array[1] = 1;
81 | array[2] = 1;
82 | array[3] = 1;
83 | array[4] = 1;
84 | array[5] = 1;
85 | array[6] = 1;
86 | array[7] = 1;
87 | array[8] = 1;
88 | array[9] = 1;
89 | array[10] = 1;
90 | array[11] = 1;
91 | }
92 |
93 | // from http://www.dotnetperls.com/dictionary
94 |
95 | public static void Dictionary1()
96 | {
97 | // Example Dictionary again.
98 | Dictionary d = new Dictionary()
99 | {
100 | {"cat", 2},
101 | {"dog", 1},
102 | {"llama", 0},
103 | {"iguana", -1}
104 | };
105 | // Loop over pairs with foreach.
106 | foreach (KeyValuePair pair in d)
107 | {
108 | Console.WriteLine("{0}, {1}",
109 | pair.Key,
110 | pair.Value);
111 | }
112 | // Use var keyword to enumerate dictionary.
113 | foreach (var pair in d)
114 | {
115 | Console.WriteLine("{0}, {1}",
116 | pair.Key,
117 | pair.Value);
118 | }
119 | }
120 |
121 | public static void Dictionary2()
122 | {
123 | Dictionary d = new Dictionary()
124 | {
125 | {"cat", 2},
126 | {"dog", 1},
127 | {"llama", 0},
128 | {"iguana", -1}
129 | };
130 | // Store keys in a List
131 | List list = new List(d.Keys);
132 | // Loop through list
133 | foreach (string k in list)
134 | {
135 | Console.WriteLine("{0}, {1}",
136 | k,
137 | d[k]);
138 | }
139 | }
140 |
141 | // from: http://www.dotnetperls.com/format
142 |
143 | public static void Format1()
144 | {
145 | // Declare three variables.
146 | // ... The values they have are not important.
147 | string value1 = "Dot Net Perls";
148 | int value2 = 10000;
149 | DateTime value3 = new DateTime(2015, 11, 1);
150 | // Use string.Format method with four arguments.
151 | // ... The first argument is the formatting string.
152 | // ... It specifies how the next arguments are formatted.
153 | string result = string.Format("{0}: {1:0.0} - {2:yyyy}",
154 | value1,
155 | value2,
156 | value3);
157 | // Write the result.
158 | Console.WriteLine(result);
159 | }
160 |
161 | public static void Format2()
162 | {
163 | // Format a ratio as a percentage string.
164 | // ... You must specify the percentage symbol.
165 | // ... It will multiply the value by 100.
166 | double ratio = 0.73;
167 | string result = string.Format("string = {0:0.0%}",
168 | ratio);
169 | Console.WriteLine(result);
170 | }
171 |
172 | public static void Format3()
173 | {
174 | // The constant formatting string.
175 | // ... It specifies the padding.
176 | // ... A negative number means to left-align.
177 | // ... A positive number means to right-align.
178 | const string format = "{0,-10} {1,10}";
179 | // Construct the strings.
180 | string line1 = string.Format(format,
181 | 100,
182 | 5);
183 | string line2 = string.Format(format,
184 | "Carrot",
185 | "Giraffe");
186 | // Write the formatted strings.
187 | Console.WriteLine(line1);
188 | Console.WriteLine(line2);
189 | }
190 |
191 | public static void Format4()
192 | {
193 | int value1 = 10995;
194 |
195 | // Write number in hex format.
196 | Console.WriteLine("{0:x}", value1);
197 | Console.WriteLine("{0:x8}", value1);
198 |
199 | Console.WriteLine("{0:X}", value1);
200 | Console.WriteLine("{0:X8}", value1);
201 |
202 | // Convert to hex.
203 | string hex = value1.ToString("X8");
204 |
205 | // Convert from hex to integer.
206 | int value2 = int.Parse(hex, NumberStyles.AllowHexSpecifier);
207 | Console.WriteLine(value1 == value2);
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Dummy/PluginsDummy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 77d08d8184c613847920c23d7bbb9e00
3 | timeCreated: 1452151025
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9ba3c0b287c4224a885eb1b90b3f076
3 | folderAsset: yes
4 | timeCreated: 1456233050
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Editor/Dummy.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 06df7baab77ff6c4780adcc673caf957
3 | folderAsset: yes
4 | timeCreated: 1456233050
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Editor/Dummy/PluginsEditorDummy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Globalization;
5 | using System.Text.RegularExpressions;
6 |
7 | public class PluginsEditorDummy
8 | {
9 | // from http://www.dotnetperls.com/word-count
10 |
11 | public static int CountWords1(string s)
12 | {
13 | MatchCollection collection = Regex.Matches(s, @"[\S]+");
14 | return collection.Count;
15 | }
16 |
17 | public static int CountWords2(string s)
18 | {
19 | int c = 0;
20 | for (int i = 1; i < s.Length; i++)
21 | {
22 | if (char.IsWhiteSpace(s[i - 1]) == true)
23 | {
24 | if (char.IsLetterOrDigit(s[i]) == true ||
25 | char.IsPunctuation(s[i]))
26 | {
27 | c++;
28 | }
29 | }
30 | }
31 | if (s.Length > 2)
32 | {
33 | c++;
34 | }
35 | return c;
36 | }
37 |
38 | // from http://www.dotnetperls.com/array-optimization
39 |
40 | const int _max = 100000000;
41 |
42 | public static void ArrayOptimization()
43 | {
44 | int[] array = new int[12];
45 | Method1(array);
46 | Method2(array);
47 |
48 | var s1 = Stopwatch.StartNew();
49 | for (int i = 0; i < _max; i++)
50 | {
51 | Method1(array);
52 | }
53 | s1.Stop();
54 | var s2 = Stopwatch.StartNew();
55 | for (int i = 0; i < _max; i++)
56 | {
57 | Method2(array);
58 | }
59 | s2.Stop();
60 | Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) /
61 | _max).ToString("0.00 ns"));
62 | Console.WriteLine(((double)(s2.Elapsed.TotalMilliseconds * 1000 * 1000) /
63 | _max).ToString("0.00 ns"));
64 | Console.Read();
65 | }
66 |
67 | static void Method1(int[] array)
68 | {
69 | // Initialize each element in for-loop.
70 | for (int i = 0; i < array.Length; i++)
71 | {
72 | array[i] = 1;
73 | }
74 | }
75 |
76 | static void Method2(int[] array)
77 | {
78 | // Initialize each element in separate statement with no enclosing loop.
79 | array[0] = 1;
80 | array[1] = 1;
81 | array[2] = 1;
82 | array[3] = 1;
83 | array[4] = 1;
84 | array[5] = 1;
85 | array[6] = 1;
86 | array[7] = 1;
87 | array[8] = 1;
88 | array[9] = 1;
89 | array[10] = 1;
90 | array[11] = 1;
91 | }
92 |
93 | // from http://www.dotnetperls.com/dictionary
94 |
95 | public static void Dictionary1()
96 | {
97 | // Example Dictionary again.
98 | Dictionary d = new Dictionary()
99 | {
100 | {"cat", 2},
101 | {"dog", 1},
102 | {"llama", 0},
103 | {"iguana", -1}
104 | };
105 | // Loop over pairs with foreach.
106 | foreach (KeyValuePair pair in d)
107 | {
108 | Console.WriteLine("{0}, {1}",
109 | pair.Key,
110 | pair.Value);
111 | }
112 | // Use var keyword to enumerate dictionary.
113 | foreach (var pair in d)
114 | {
115 | Console.WriteLine("{0}, {1}",
116 | pair.Key,
117 | pair.Value);
118 | }
119 | }
120 |
121 | public static void Dictionary2()
122 | {
123 | Dictionary d = new Dictionary()
124 | {
125 | {"cat", 2},
126 | {"dog", 1},
127 | {"llama", 0},
128 | {"iguana", -1}
129 | };
130 | // Store keys in a List
131 | List list = new List(d.Keys);
132 | // Loop through list
133 | foreach (string k in list)
134 | {
135 | Console.WriteLine("{0}, {1}",
136 | k,
137 | d[k]);
138 | }
139 | }
140 |
141 | // from: http://www.dotnetperls.com/format
142 |
143 | public static void Format1()
144 | {
145 | // Declare three variables.
146 | // ... The values they have are not important.
147 | string value1 = "Dot Net Perls";
148 | int value2 = 10000;
149 | DateTime value3 = new DateTime(2015, 11, 1);
150 | // Use string.Format method with four arguments.
151 | // ... The first argument is the formatting string.
152 | // ... It specifies how the next arguments are formatted.
153 | string result = string.Format("{0}: {1:0.0} - {2:yyyy}",
154 | value1,
155 | value2,
156 | value3);
157 | // Write the result.
158 | Console.WriteLine(result);
159 | }
160 |
161 | public static void Format2()
162 | {
163 | // Format a ratio as a percentage string.
164 | // ... You must specify the percentage symbol.
165 | // ... It will multiply the value by 100.
166 | double ratio = 0.73;
167 | string result = string.Format("string = {0:0.0%}",
168 | ratio);
169 | Console.WriteLine(result);
170 | }
171 |
172 | public static void Format3()
173 | {
174 | // The constant formatting string.
175 | // ... It specifies the padding.
176 | // ... A negative number means to left-align.
177 | // ... A positive number means to right-align.
178 | const string format = "{0,-10} {1,10}";
179 | // Construct the strings.
180 | string line1 = string.Format(format,
181 | 100,
182 | 5);
183 | string line2 = string.Format(format,
184 | "Carrot",
185 | "Giraffe");
186 | // Write the formatted strings.
187 | Console.WriteLine(line1);
188 | Console.WriteLine(line2);
189 | }
190 |
191 | public static void Format4()
192 | {
193 | int value1 = 10995;
194 |
195 | // Write number in hex format.
196 | Console.WriteLine("{0:x}", value1);
197 | Console.WriteLine("{0:x8}", value1);
198 |
199 | Console.WriteLine("{0:X}", value1);
200 | Console.WriteLine("{0:X8}", value1);
201 |
202 | // Convert to hex.
203 | string hex = value1.ToString("X8");
204 |
205 | // Convert from hex to integer.
206 | int value2 = int.Parse(hex, NumberStyles.AllowHexSpecifier);
207 | Console.WriteLine(value1 == value2);
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Plugins/Editor/Dummy/PluginsEditorDummy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 08ce01e24cf159e41be5222f82dc518a
3 | timeCreated: 1456233056
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 28aac23b585ce0e48b5a8cc9b91b11ec
3 | folderAsset: yes
4 | timeCreated: 1452128609
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scenes/MainScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8b97fb09bc27a604e83eb781ff98920f
3 | timeCreated: 1452128606
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e20eceadb2ecd1242b63cad56e67f839
3 | folderAsset: yes
4 | timeCreated: 1452128618
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scripts/Dummy.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c406e340a1e982c49b62aad31ea1fb6f
3 | folderAsset: yes
4 | timeCreated: 1452128931
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scripts/Dummy/ScriptsDummy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Globalization;
5 | using System.Text.RegularExpressions;
6 |
7 | public class ScriptsDummy
8 | {
9 | // from http://www.dotnetperls.com/word-count
10 |
11 | public static int CountWords1(string s)
12 | {
13 | MatchCollection collection = Regex.Matches(s, @"[\S]+");
14 | return collection.Count;
15 | }
16 |
17 | public static int CountWords2(string s)
18 | {
19 | int c = 0;
20 | for (int i = 1; i < s.Length; i++)
21 | {
22 | if (char.IsWhiteSpace(s[i - 1]) == true)
23 | {
24 | if (char.IsLetterOrDigit(s[i]) == true ||
25 | char.IsPunctuation(s[i]))
26 | {
27 | c++;
28 | }
29 | }
30 | }
31 | if (s.Length > 2)
32 | {
33 | c++;
34 | }
35 | return c;
36 | }
37 |
38 | // from http://www.dotnetperls.com/array-optimization
39 |
40 | const int _max = 100000000;
41 |
42 | public static void ArrayOptimization()
43 | {
44 | int[] array = new int[12];
45 | Method1(array);
46 | Method2(array);
47 |
48 | var s1 = Stopwatch.StartNew();
49 | for (int i = 0; i < _max; i++)
50 | {
51 | Method1(array);
52 | }
53 | s1.Stop();
54 | var s2 = Stopwatch.StartNew();
55 | for (int i = 0; i < _max; i++)
56 | {
57 | Method2(array);
58 | }
59 | s2.Stop();
60 | Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000 * 1000) /
61 | _max).ToString("0.00 ns"));
62 | Console.WriteLine(((double)(s2.Elapsed.TotalMilliseconds * 1000 * 1000) /
63 | _max).ToString("0.00 ns"));
64 | Console.Read();
65 | }
66 |
67 | static void Method1(int[] array)
68 | {
69 | // Initialize each element in for-loop.
70 | for (int i = 0; i < array.Length; i++)
71 | {
72 | array[i] = 1;
73 | }
74 | }
75 |
76 | static void Method2(int[] array)
77 | {
78 | // Initialize each element in separate statement with no enclosing loop.
79 | array[0] = 1;
80 | array[1] = 1;
81 | array[2] = 1;
82 | array[3] = 1;
83 | array[4] = 1;
84 | array[5] = 1;
85 | array[6] = 1;
86 | array[7] = 1;
87 | array[8] = 1;
88 | array[9] = 1;
89 | array[10] = 1;
90 | array[11] = 1;
91 | }
92 |
93 | // from http://www.dotnetperls.com/dictionary
94 |
95 | public static void Dictionary1()
96 | {
97 | // Example Dictionary again.
98 | Dictionary d = new Dictionary()
99 | {
100 | {"cat", 2},
101 | {"dog", 1},
102 | {"llama", 0},
103 | {"iguana", -1}
104 | };
105 | // Loop over pairs with foreach.
106 | foreach (KeyValuePair pair in d)
107 | {
108 | Console.WriteLine("{0}, {1}",
109 | pair.Key,
110 | pair.Value);
111 | }
112 | // Use var keyword to enumerate dictionary.
113 | foreach (var pair in d)
114 | {
115 | Console.WriteLine("{0}, {1}",
116 | pair.Key,
117 | pair.Value);
118 | }
119 | }
120 |
121 | public static void Dictionary2()
122 | {
123 | Dictionary d = new Dictionary()
124 | {
125 | {"cat", 2},
126 | {"dog", 1},
127 | {"llama", 0},
128 | {"iguana", -1}
129 | };
130 | // Store keys in a List
131 | List list = new List(d.Keys);
132 | // Loop through list
133 | foreach (string k in list)
134 | {
135 | Console.WriteLine("{0}, {1}",
136 | k,
137 | d[k]);
138 | }
139 | }
140 |
141 | // from: http://www.dotnetperls.com/format
142 |
143 | public static void Format1()
144 | {
145 | // Declare three variables.
146 | // ... The values they have are not important.
147 | string value1 = "Dot Net Perls";
148 | int value2 = 10000;
149 | DateTime value3 = new DateTime(2015, 11, 1);
150 | // Use string.Format method with four arguments.
151 | // ... The first argument is the formatting string.
152 | // ... It specifies how the next arguments are formatted.
153 | string result = string.Format("{0}: {1:0.0} - {2:yyyy}",
154 | value1,
155 | value2,
156 | value3);
157 | // Write the result.
158 | Console.WriteLine(result);
159 | }
160 |
161 | public static void Format2()
162 | {
163 | // Format a ratio as a percentage string.
164 | // ... You must specify the percentage symbol.
165 | // ... It will multiply the value by 100.
166 | double ratio = 0.73;
167 | string result = string.Format("string = {0:0.0%}",
168 | ratio);
169 | Console.WriteLine(result);
170 | }
171 |
172 | public static void Format3()
173 | {
174 | // The constant formatting string.
175 | // ... It specifies the padding.
176 | // ... A negative number means to left-align.
177 | // ... A positive number means to right-align.
178 | const string format = "{0,-10} {1,10}";
179 | // Construct the strings.
180 | string line1 = string.Format(format,
181 | 100,
182 | 5);
183 | string line2 = string.Format(format,
184 | "Carrot",
185 | "Giraffe");
186 | // Write the formatted strings.
187 | Console.WriteLine(line1);
188 | Console.WriteLine(line2);
189 | }
190 |
191 | public static void Format4()
192 | {
193 | int value1 = 10995;
194 |
195 | // Write number in hex format.
196 | Console.WriteLine("{0:x}", value1);
197 | Console.WriteLine("{0:x8}", value1);
198 |
199 | Console.WriteLine("{0:X}", value1);
200 | Console.WriteLine("{0:X8}", value1);
201 |
202 | // Convert to hex.
203 | string hex = value1.ToString("X8");
204 |
205 | // Convert from hex to integer.
206 | int value2 = int.Parse(hex, NumberStyles.AllowHexSpecifier);
207 | Console.WriteLine(value1 == value2);
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scripts/Dummy/ScriptsDummy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0dc58f7029017c542b279763e5cc256f
3 | timeCreated: 1452151021
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scripts/MainScene.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.UI;
3 |
4 | public class MainScene : MonoBehaviour
5 | {
6 | public Text Text;
7 |
8 | void Start()
9 | {
10 | Text.text = "Started!";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/samples/Benchmark/Assets/Scripts/MainScene.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 88e4c1cc579180544a5be512c7d371cb
3 | timeCreated: 1452128726
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Benchmark/InstallCompiler.bat:
--------------------------------------------------------------------------------
1 | XCOPY /S /Y ..\..\bin\Unity5\* .
2 | PAUSE.
--------------------------------------------------------------------------------
/samples/Benchmark/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 |
--------------------------------------------------------------------------------
/samples/Benchmark/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 |
--------------------------------------------------------------------------------
/samples/Benchmark/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: 2
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_SolverIterationCount: 6
13 | m_QueriesHitTriggers: 1
14 | m_EnableAdaptiveForce: 0
15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
16 |
--------------------------------------------------------------------------------
/samples/Benchmark/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 |
--------------------------------------------------------------------------------
/samples/Benchmark/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: Hidden Meta Files
8 | m_SerializationMode: 2
9 | m_WebSecurityEmulationEnabled: 0
10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
11 | m_DefaultBehaviorMode: 0
12 | m_SpritePackerMode: 2
13 | m_SpritePackerPaddingPower: 1
14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
15 | m_ProjectGenerationRootNamespace:
16 |
--------------------------------------------------------------------------------
/samples/Benchmark/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: 5
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_LegacyDeferred:
14 | m_Mode: 1
15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
16 | m_AlwaysIncludedShaders:
17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
23 | m_PreloadedShaders: []
24 | m_ShaderSettings:
25 | useScreenSpaceShadows: 1
26 | m_BuildTargetShaderSettings: []
27 | m_LightmapStripping: 0
28 | m_FogStripping: 0
29 | m_LightmapKeepPlain: 1
30 | m_LightmapKeepDirCombined: 1
31 | m_LightmapKeepDirSeparate: 1
32 | m_LightmapKeepDynamicPlain: 1
33 | m_LightmapKeepDynamicDirCombined: 1
34 | m_LightmapKeepDynamicDirSeparate: 1
35 | m_FogKeepLinear: 1
36 | m_FogKeepExp: 1
37 | m_FogKeepExp2: 1
38 |
--------------------------------------------------------------------------------
/samples/Benchmark/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshAreas:
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 |
--------------------------------------------------------------------------------
/samples/Benchmark/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 |
--------------------------------------------------------------------------------
/samples/Benchmark/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_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26 |
--------------------------------------------------------------------------------
/samples/Benchmark/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.5f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/samples/Benchmark/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: 2
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: 2
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: 2
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: 0
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: 2
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: 2
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: 2
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 | BlackBerry: 2
168 | GLES Emulation: 5
169 | Nintendo 3DS: 5
170 | PS3: 5
171 | PS4: 5
172 | PSM: 5
173 | PSP2: 2
174 | Samsung TV: 2
175 | Standalone: 5
176 | Tizen: 2
177 | WP8: 5
178 | Web: 5
179 | WebGL: 3
180 | WiiU: 5
181 | Windows Store Apps: 5
182 | XBOX360: 5
183 | XboxOne: 5
184 | iPhone: 2
185 | tvOS: 5
186 |
--------------------------------------------------------------------------------
/samples/Benchmark/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 |
--------------------------------------------------------------------------------
/samples/Benchmark/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 |
--------------------------------------------------------------------------------
/samples/Benchmark/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!292 &1
4 | UnityAdsSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_InitializeOnStartup: 1
8 | m_TestMode: 0
9 | m_EnabledPlatforms: 4294967295
10 | m_IosGameId:
11 | m_AndroidGameId:
12 |
--------------------------------------------------------------------------------
/samples/Benchmark/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 | UnityPurchasingSettings:
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | UnityAnalyticsSettings:
10 | m_Enabled: 0
11 | m_InitializeOnStartup: 1
12 | m_TestMode: 0
13 | m_TestEventUrl:
14 | m_TestConfigUrl:
15 |
--------------------------------------------------------------------------------
/samples/Benchmark/SourceDelete.bat:
--------------------------------------------------------------------------------
1 | DEL /Q .\Assets\Editor\Dummy\X_*
2 | DEL /Q .\Assets\Plugins\Dummy\X_*
3 | DEL /Q .\Assets\Plugins\Editor\Dummy\X_*
4 | DEL /Q .\Assets\Scripts\Dummy\X_*
5 | PAUSE.
6 |
--------------------------------------------------------------------------------
/samples/Benchmark/SourcePopulate.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 |
4 |
5 | def GenerateSources(path, name, count):
6 | print "*", name, count
7 | template = open(os.path.join(path, name) + ".cs").read()
8 | for i in range(count):
9 | new_name = "X_{0}_{1:04d}".format(name, i)
10 | src = template.replace(name, new_name)
11 | with open(os.path.join(path, new_name) + ".cs", "wb") as f:
12 | f.write(src)
13 |
14 |
15 | def main(editor_count, plugins_count, plugins_editor_count, scripts_count):
16 | GenerateSources(r'./Assets/Editor/Dummy', 'EditorDummy', editor_count)
17 | GenerateSources(r'./Assets/Plugins/Dummy', 'PluginsDummy', plugins_count)
18 | GenerateSources(r'./Assets/Plugins/Editor/Dummy', 'PluginsEditorDummy', plugins_editor_count)
19 | GenerateSources(r'./Assets/Scripts/Dummy', 'ScriptsDummy', scripts_count)
20 |
21 |
22 | if len(sys.argv) != 5:
23 | print "[Usage]",
24 | print os.path.split(sys.argv[0])[1], "editor_count plugins_count plugins_editor_count scripts_count"
25 | else:
26 | counts = [int(v) for v in sys.argv[1:]]
27 | main(*counts)
28 |
--------------------------------------------------------------------------------
/tools/nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tools/nuget/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/tools/nuget/nuget.exe
--------------------------------------------------------------------------------
/tools/nuget/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/tools/pdb2mdb/README.md:
--------------------------------------------------------------------------------
1 | The Visual Studio Tools for Unity are able to convert .NET debug symbol files (namely pdb files) to debug symbols files that are understood by Unity's scripting engine (namely .dll.mdb files) when importing both the .dll and the .pdb in the Assets folder.
2 |
3 | If you prefer to handle the conversion yourself you need to call a tool named pdb2mdb on the .dll associated with the .pdb:
4 |
5 | ```
6 | pdb2mdb MyLibrary.dll
7 | ```
8 |
9 | Will produce a MyLibrary.dll.mdb usable on Unity if MyLibrary.pdb is present.
10 |
11 | The .pdb files generated by Visual Studio 2015 can contain new informations that are not handled by the pdb2mdb file shipped by Unity.
12 |
13 | You can download below the version that VSTU is using which handles the new 2015 format. This executable is self-contained and embeds all the references it needs, namely Mono.Cecil.
14 |
15 | License Information:
16 |
17 | * pdb2mdb is licensed under the Microsoft Public License (Ms-PL).
18 | * Mono.Cecil is licensed under the MIT/X11.
--------------------------------------------------------------------------------
/tools/pdb2mdb/pdb2mdb.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SaladLab/Unity3D.IncrementalCompiler/9d197562f369ef276b4aebde0ec3a3a2e7db6041/tools/pdb2mdb/pdb2mdb.exe
--------------------------------------------------------------------------------