├── ProjectSettings ├── boot.config ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── PresetManager.asset ├── NetworkManager.asset ├── TimeManager.asset ├── EditorBuildSettings.asset ├── VersionControlSettings.asset ├── AudioManager.asset ├── VFXManager.asset ├── EditorSettings.asset ├── TagManager.asset ├── DynamicsManager.asset ├── Physics2DSettings.asset ├── UnityConnectSettings.asset ├── PackageManagerSettings.asset ├── NavMeshAreas.asset ├── MemorySettings.asset ├── GraphicsSettings.asset ├── QualitySettings.asset ├── InputManager.asset └── ProjectSettings.asset ├── UserSettings ├── Search.settings ├── EditorUserSettings.asset └── Layouts │ └── default-2021.dwlt ├── Packages ├── manifest.json └── packages-lock.json ├── Assets ├── Plugins │ ├── WebGL │ │ ├── init.jslib │ │ ├── native.h │ │ ├── init.jslib.meta │ │ ├── native.c.meta │ │ ├── native.h.meta │ │ └── native.c │ └── WebGL.meta ├── MonoPInvokeAttribute.cs ├── Main.unity.meta ├── Editor.meta ├── Plugins.meta ├── WebGLTemplates │ ├── TestTemplate │ │ ├── index.html.meta │ │ ├── tests.js.meta │ │ ├── index.html │ │ └── tests.js │ └── TestTemplate.meta ├── WebGLTemplates.meta ├── Receiver.cs.meta ├── Editor │ ├── EditorTools.cs.meta │ └── EditorTools.cs ├── MonoPInvokeAttribute.cs.meta ├── Receiver.cs └── Main.unity ├── .gitignore ├── .github └── FUNDING.yml └── README.md /ProjectSettings/boot.config: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /UserSettings/Search.settings: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.2.11f1 2 | m_EditorVersionWithRevision: 2021.2.11f1 (e50cafbb4399) 3 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ide.rider": "3.0.9", 4 | "com.unity.modules.jsonserialize": "1.0.0" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Assets/Plugins/WebGL/init.jslib: -------------------------------------------------------------------------------- 1 | var MyPlugin = { 2 | StartTests : function() { 3 | window.run_tests(); 4 | } 5 | } 6 | 7 | mergeInto(LibraryManager.library, MyPlugin); 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/MonoPInvokeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | public class MonoPInvokeCallbackAttribute : System.Attribute 4 | { 5 | public Type type; 6 | public MonoPInvokeCallbackAttribute( Type t ) { type = t; } 7 | } -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/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 | -------------------------------------------------------------------------------- /Assets/Main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8496819156e7f44f881f09730ebb7784 3 | timeCreated: 1454074689 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6917781a247eb4e8aa7aff7407340811 3 | folderAsset: yes 4 | timeCreated: 1489069962 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 573f940b502a9484c9f57e33cfc0dd2e 3 | folderAsset: yes 4 | timeCreated: 1454073256 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/TestTemplate/index.html.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0291f5afa857451fa766ddbc144fa5c 3 | timeCreated: 1454109484 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/TestTemplate/tests.js.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 79a53323a0db849ffa33483a49c4eafe 3 | timeCreated: 1454109484 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/WebGL.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bdf66cc84a00e416784cbea325b142f4 3 | folderAsset: yes 4 | timeCreated: 1454073261 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4254d1ade048847c3921b0b1c1295c4a 3 | folderAsset: yes 4 | timeCreated: 1454109484 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Main.unity 10 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/TestTemplate.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 23a3778a611ed49638521b04e4cbbebe 3 | folderAsset: yes 4 | timeCreated: 1454109484 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Receiver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcbaaebaa014f433c95f94626ad8e16b 3 | timeCreated: 1454073402 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Editor/EditorTools.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa80229e357394129a929456f2afd12c 3 | timeCreated: 1489069972 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/MonoPInvokeAttribute.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68b6cdc5f081b45e588708798c073211 3 | timeCreated: 1454073488 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | m_CompiledVersion: 0 14 | m_RuntimeVersion: 0 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | 21 | 22 | # Unity3D generated meta files 23 | *.pidb.meta 24 | 25 | # Unity3D Generated File On Crash Reports 26 | sysinfo.txt 27 | 28 | # Rider 29 | **/.idea 30 | -------------------------------------------------------------------------------- /Assets/Plugins/WebGL/native.h: -------------------------------------------------------------------------------- 1 | struct Vector3 { 2 | float x,y,z; 3 | }; 4 | 5 | typedef void (*callback_v)(); 6 | typedef void (*callback_vi)(int32_t a); 7 | typedef void (*callback_vf)(float a); 8 | typedef void (*callback_vs)(const char *a); 9 | typedef void (*callback_vv3)(struct Vector3); 10 | typedef void (*callback_vx)(int32_t,int32_t,struct Vector3,struct Vector3); 11 | 12 | typedef int32_t (*callback_I)(); 13 | typedef float (*callback_F)(); 14 | typedef const char * (*callback_S)(); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | vcSharedLogLevel: 9 | value: 0d5e400f0650 10 | flags: 0 11 | m_VCAutomaticAdd: 1 12 | m_VCDebugCom: 0 13 | m_VCDebugCmd: 0 14 | m_VCDebugOut: 0 15 | m_SemanticMergeMode: 2 16 | m_VCShowFailedCheckout: 1 17 | m_VCOverwriteFailedCheckoutAssets: 1 18 | m_VCProjectOverlayIcons: 1 19 | m_VCHierarchyOverlayIcons: 1 20 | m_VCOtherOverlayIcons: 1 21 | m_VCAllowAsyncUpdate: 1 22 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # [atteneder] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: tteneder 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ext.nunit": { 4 | "version": "1.0.6", 5 | "depth": 1, 6 | "source": "registry", 7 | "dependencies": {}, 8 | "url": "https://packages.unity.com" 9 | }, 10 | "com.unity.ide.rider": { 11 | "version": "3.0.9", 12 | "depth": 0, 13 | "source": "registry", 14 | "dependencies": { 15 | "com.unity.ext.nunit": "1.0.6" 16 | }, 17 | "url": "https://packages.unity.com" 18 | }, 19 | "com.unity.modules.jsonserialize": { 20 | "version": "1.0.0", 21 | "depth": 0, 22 | "source": "builtin", 23 | "dependencies": {} 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UnityJavascriptInteraction 2 | 3 | Playground and showcase of an alternative and fast invocation method of managed C# code from Javascript. 4 | 5 | ## How to try: 6 | 7 | 1. Open the project with Unity 8 | 2. Switch the build target to WebGL 9 | 3. Build the project and open it in a browser. 10 | 4. The tests are run automatically. Open the browser's developer console to see the results logs. 11 | 12 | ## Support 13 | 14 | Like this demo? You can show your appreciation and ... 15 | 16 | [![Buy me a coffee](https://az743702.vo.msecnd.net/cdn/kofi1.png?v=0)][kofi] 17 | 18 | ## Discussion 19 | 20 | [Original post in the Unity forums](http://forum.unity3d.com/threads/super-fast-javascript-interaction-on-webgl.382734/) 21 | 22 | [kofi]: https://ko-fi.com/C0C3BW7G -------------------------------------------------------------------------------- /Assets/Plugins/WebGL/init.jslib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2908ce4f4a7e74478b7c07e44f1713dd 3 | timeCreated: 1489071810 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 2 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | data: 13 | first: 14 | Any: 15 | second: 16 | enabled: 0 17 | settings: {} 18 | data: 19 | first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | data: 26 | first: 27 | Facebook: WebGL 28 | second: 29 | enabled: 1 30 | settings: {} 31 | data: 32 | first: 33 | WebGL: WebGL 34 | second: 35 | enabled: 1 36 | settings: {} 37 | userData: 38 | assetBundleName: 39 | assetBundleVariant: 40 | -------------------------------------------------------------------------------- /Assets/Plugins/WebGL/native.c.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a39a783d223194bdb9d68854e2c872c2 3 | timeCreated: 1454073385 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 2 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | data: 13 | first: 14 | Any: 15 | second: 16 | enabled: 0 17 | settings: {} 18 | data: 19 | first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | data: 26 | first: 27 | Facebook: WebGL 28 | second: 29 | enabled: 1 30 | settings: {} 31 | data: 32 | first: 33 | WebGL: WebGL 34 | second: 35 | enabled: 1 36 | settings: {} 37 | userData: 38 | assetBundleName: 39 | assetBundleVariant: 40 | -------------------------------------------------------------------------------- /Assets/Plugins/WebGL/native.h.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4a2f7f300e869457da315dddafddab93 3 | timeCreated: 1454174867 4 | licenseType: Pro 5 | PluginImporter: 6 | serializedVersion: 2 7 | iconMap: {} 8 | executionOrder: {} 9 | isPreloaded: 0 10 | isOverridable: 0 11 | platformData: 12 | data: 13 | first: 14 | Any: 15 | second: 16 | enabled: 0 17 | settings: {} 18 | data: 19 | first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | data: 26 | first: 27 | Facebook: WebGL 28 | second: 29 | enabled: 1 30 | settings: {} 31 | data: 32 | first: 33 | WebGL: WebGL 34 | second: 35 | enabled: 1 36 | settings: {} 37 | userData: 38 | assetBundleName: 39 | assetBundleVariant: 40 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | UnityAdsSettings: 27 | m_Enabled: 0 28 | m_InitializeOnStartup: 1 29 | m_TestMode: 0 30 | m_IosGameId: 31 | m_AndroidGameId: 32 | m_GameIds: {} 33 | m_GameId: 34 | PerformanceReportingSettings: 35 | m_Enabled: 0 36 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /Assets/Editor/EditorTools.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class EditorTools { 5 | 6 | [MenuItem("Tools/Set Emscripten Arguments")] 7 | public static void SetAdvancedBuildOptionsWebGL() { 8 | //Debug.Log( PlayerSettings.GetPropertyString("emscriptenArgs", BuildTargetGroup.WebGL) ); 9 | 10 | // Minimize build size: 11 | //PlayerSettings.SetPropertyString("emscriptenArgs", "-Oz -s INLINING_LIMIT=1 -s OUTLINING_LIMIT=0 --llvm-lto 2", BuildTargetGroup.WebGL); 12 | //PlayerSettings.SetPropertyString("emscriptenArgs", "-Oz -s INLINING_LIMIT=1 -s OUTLINING_LIMIT=0", BuildTargetGroup.WebGL); 13 | 14 | // Get more assert/error information 15 | #if UNITY_5_6_OR_NEWER 16 | PlayerSettings.WebGL.emscriptenArgs = "--profiling -s ASSERTIONS=2"; 17 | #else 18 | PlayerSettings.SetPropertyString("emscriptenArgs", "--profiling -s ASSERTIONS=2", BuildTargetGroup.WebGL); 19 | #endif 20 | // Integrated kernel sources 21 | //PlayerSettings.SetPropertyString("emscriptenArgs", "-Oz -std=c++11 -D NDEBUG", BuildTargetGroup.WebGL); 22 | } 23 | 24 | [MenuItem("Tools/Unset Emscripten Arguments")] 25 | public static void UnsetAdvancedBuildOptionsWebGL() { 26 | // Get more assert/error information 27 | #if UNITY_5_6_OR_NEWER 28 | PlayerSettings.WebGL.emscriptenArgs = ""; 29 | #else 30 | PlayerSettings.SetPropertyString("emscriptenArgs", "", BuildTargetGroup.WebGL); 31 | #endif 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Assets/Plugins/WebGL/native.c: -------------------------------------------------------------------------------- 1 | // #define EMSCRIPTEN_KEEPALIVE 2 | 3 | #include 4 | #include "emscripten.h" 5 | #include "native.h" 6 | 7 | callback_v cb_v; 8 | callback_vi cb_vi; 9 | callback_vf cb_vf; 10 | callback_vs cb_vs; 11 | callback_vv3 cb_vv3; 12 | callback_vs cb_vv3json; 13 | callback_vx cb_vx; 14 | callback_vs cb_vxjson; 15 | 16 | callback_I cb_i; 17 | callback_F cb_f; 18 | callback_S cb_s; 19 | 20 | void set_callbacks( 21 | callback_v p_v, 22 | callback_vi p_vi, 23 | callback_vf p_vf, 24 | callback_vs p_vs, 25 | callback_vv3 p_vv3, 26 | callback_vs p_vv3json, 27 | callback_vx p_vx, 28 | callback_vs p_vxjson, 29 | callback_I p_i, 30 | callback_F p_f, 31 | callback_S p_s 32 | ) 33 | { 34 | cb_v = p_v; 35 | cb_vi = p_vi; 36 | cb_vf = p_vf; 37 | cb_vs = p_vs; 38 | cb_vv3 = p_vv3; 39 | cb_vv3json = p_vv3json; 40 | cb_vx = p_vx; 41 | cb_vxjson = p_vxjson; 42 | cb_i = p_i; 43 | cb_f = p_f; 44 | cb_s = p_s; 45 | } 46 | 47 | void EMSCRIPTEN_KEEPALIVE call_cb_v() { 48 | cb_v(); 49 | } 50 | 51 | void EMSCRIPTEN_KEEPALIVE call_cb_vi(int32_t a) { 52 | cb_vi(a); 53 | } 54 | 55 | void EMSCRIPTEN_KEEPALIVE call_cb_vf(float a) { 56 | cb_vf(a); 57 | } 58 | 59 | void EMSCRIPTEN_KEEPALIVE call_cb_vs(const char *a) { 60 | cb_vs(a); 61 | } 62 | 63 | void EMSCRIPTEN_KEEPALIVE call_cb_vv3(struct Vector3 a) { 64 | cb_vv3(a); 65 | } 66 | 67 | void EMSCRIPTEN_KEEPALIVE call_cb_vv3json(const char *a) { 68 | cb_vv3json(a); 69 | } 70 | 71 | void EMSCRIPTEN_KEEPALIVE call_cb_vx(int32_t a,int32_t b,struct Vector3 c,struct Vector3 d) { 72 | cb_vx(a,b,c,d); 73 | } 74 | 75 | void EMSCRIPTEN_KEEPALIVE call_cb_vxjson(const char *a) { 76 | cb_vxjson(a); 77 | } 78 | 79 | int32_t EMSCRIPTEN_KEEPALIVE call_cb_i() { 80 | return cb_i(); 81 | } 82 | 83 | float EMSCRIPTEN_KEEPALIVE call_cb_f() { 84 | return cb_f(); 85 | } 86 | 87 | const char * EMSCRIPTEN_KEEPALIVE call_cb_s() { 88 | return cb_s(); 89 | } -------------------------------------------------------------------------------- /Assets/WebGLTemplates/TestTemplate/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Unity WebGL Player | {{{ PRODUCT_NAME }}} 7 | 8 | 9 | 10 | 11 | 12 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /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: 11 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseCCT: 0 62 | -------------------------------------------------------------------------------- /Assets/Receiver.cs: -------------------------------------------------------------------------------- 1 | // #define VERBOSE 2 | 3 | using UnityEngine; 4 | using System.Collections; 5 | using System.Runtime.InteropServices; 6 | 7 | public class Receiver : MonoBehaviour { 8 | 9 | delegate void delegate_V(); 10 | delegate void delegate_Vi(int i); 11 | delegate void delegate_Vf(float f); 12 | delegate void delegate_Vs(string s); 13 | delegate void delegate_Vv3(Vector3 a); 14 | delegate void delegate_Vx(int a, int b, Vector3 c, Vector3 d); 15 | 16 | delegate int delegate_I(); 17 | delegate float delegate_F(); 18 | delegate string delegate_S(); 19 | 20 | struct combinedArgs { 21 | public int a; 22 | public int b; 23 | public Vector3 c; 24 | public Vector3 d; 25 | 26 | public override string ToString() { 27 | return string.Format ("{0} {1} {2} {3}", a, b, c, d); 28 | } 29 | } 30 | 31 | void Start () { 32 | set_callbacks ( 33 | TargetV, 34 | TargetVi, 35 | TargetVf, 36 | TargetVs, 37 | TargetVv3, 38 | TargetVv3Json, 39 | TargetVx, 40 | TargetVxJson, 41 | TargetI, 42 | TargetF, 43 | TargetS 44 | ); 45 | 46 | StartTests (); 47 | } 48 | 49 | #region SENDMESSAGE_WRAPPERS 50 | private void TargetVWrapper() { 51 | TargetV (); 52 | } 53 | 54 | private void TargetViWrapper(int a) { 55 | TargetVi (a); 56 | } 57 | 58 | private void TargetVfWrapper(float a) { 59 | TargetVf (a); 60 | } 61 | 62 | private void TargetVsWrapper(string a) { 63 | TargetVs (a); 64 | } 65 | 66 | private void TargetVv3Wrapper(string json) { 67 | TargetVv3Json (json); 68 | } 69 | 70 | private void TargetVxWrapper(string json) { 71 | TargetVxJson (json); 72 | } 73 | #endregion 74 | 75 | [MonoPInvokeCallback (typeof (delegate_V))] 76 | private static void TargetV() { 77 | #if VERBOSE 78 | Debug.Log ("TargetMethod"); 79 | #endif 80 | } 81 | 82 | [MonoPInvokeCallback (typeof (delegate_Vi))] 83 | private static void TargetVi(int i) { 84 | #if VERBOSE 85 | Debug.Log (string.Format("Vi: {0}",i)); 86 | #endif 87 | } 88 | 89 | [MonoPInvokeCallback (typeof (delegate_Vf))] 90 | private static void TargetVf(float f) { 91 | #if VERBOSE 92 | Debug.Log (string.Format("Vf: {0}",f)); 93 | #endif 94 | } 95 | 96 | [MonoPInvokeCallback (typeof (delegate_Vs))] 97 | private static void TargetVs(string s) { 98 | #if VERBOSE 99 | Debug.Log (string.Format("Vs: {0}",s)); 100 | #endif 101 | } 102 | 103 | [MonoPInvokeCallback (typeof (delegate_Vv3))] 104 | private static void TargetVv3(Vector3 a) { 105 | #if VERBOSE 106 | Debug.Log (string.Format("Vv3: {0}",a)); 107 | #endif 108 | } 109 | 110 | [MonoPInvokeCallback (typeof (delegate_Vs))] 111 | private static void TargetVv3Json(string json) { 112 | Vector3 a = JsonUtility.FromJson (json); 113 | #if VERBOSE 114 | Debug.Log (string.Format("Vv3Json: {0}",a)); 115 | #endif 116 | } 117 | 118 | 119 | [MonoPInvokeCallback (typeof (delegate_Vx))] 120 | private static void TargetVx(int a, int b, Vector3 c, Vector3 d) { 121 | #if VERBOSE 122 | Debug.Log (string.Format("{0} {1} {2} {3}",a,b,c,d)); 123 | #endif 124 | } 125 | 126 | [MonoPInvokeCallback (typeof (delegate_Vs))] 127 | private static void TargetVxJson(string json) { 128 | combinedArgs args = JsonUtility.FromJson (json); 129 | #if VERBOSE 130 | Debug.Log (args.ToString()); 131 | #endif 132 | } 133 | 134 | [MonoPInvokeCallback (typeof (delegate_I))] 135 | private static int TargetI() { 136 | return 42; 137 | } 138 | 139 | [MonoPInvokeCallback (typeof (delegate_F))] 140 | private static float TargetF() { 141 | return 42.42f; 142 | } 143 | 144 | [MonoPInvokeCallback (typeof (delegate_S))] 145 | private static string TargetS() { 146 | return "This is a return string."; 147 | } 148 | 149 | [DllImport("__Internal")] 150 | private static extern void StartTests(); 151 | 152 | [DllImport("__Internal")] 153 | private static extern void set_callbacks( 154 | delegate_V v, 155 | delegate_Vi vi, 156 | delegate_Vf vf, 157 | delegate_Vs vs, 158 | delegate_Vv3 vv3, 159 | delegate_Vs vv3json, 160 | delegate_Vx vx, 161 | delegate_Vs vxjson, 162 | delegate_I i, 163 | delegate_F f, 164 | delegate_S s 165 | ); 166 | } 167 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Main.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | SceneSettings: 5 | m_ObjectHideFlags: 0 6 | m_PVSData: 7 | m_PVSObjectsArray: [] 8 | m_PVSPortalsArray: [] 9 | m_OcclusionBakeSettings: 10 | smallestOccluder: 5 11 | smallestHole: 0.25 12 | backfaceThreshold: 100 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 6 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SkyboxMaterial: {fileID: 0} 29 | m_HaloStrength: 0.5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | --- !u!157 &3 41 | LightmapSettings: 42 | m_ObjectHideFlags: 0 43 | serializedVersion: 6 44 | m_GIWorkflowMode: 0 45 | m_LightmapsMode: 1 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 0 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 3 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AOMaxDistance: 1 62 | m_Padding: 2 63 | m_CompAOExponent: 0 64 | m_LightmapParameters: {fileID: 0} 65 | m_TextureCompression: 1 66 | m_FinalGather: 0 67 | m_FinalGatherRayCount: 1024 68 | m_ReflectionCompression: 2 69 | m_LightingDataAsset: {fileID: 0} 70 | m_RuntimeCPUUsage: 25 71 | --- !u!196 &4 72 | NavMeshSettings: 73 | serializedVersion: 2 74 | m_ObjectHideFlags: 0 75 | m_BuildSettings: 76 | serializedVersion: 2 77 | agentRadius: 0.5 78 | agentHeight: 2 79 | agentSlope: 45 80 | agentClimb: 0.4 81 | ledgeDropHeight: 0 82 | maxJumpAcrossDistance: 0 83 | accuratePlacement: 0 84 | minRegionArea: 2 85 | cellSize: 0.16666667 86 | manualCellSize: 0 87 | m_NavMeshData: {fileID: 0} 88 | --- !u!1 &1345187583 89 | GameObject: 90 | m_ObjectHideFlags: 0 91 | m_PrefabParentObject: {fileID: 0} 92 | m_PrefabInternal: {fileID: 0} 93 | serializedVersion: 4 94 | m_Component: 95 | - 4: {fileID: 1345187588} 96 | - 20: {fileID: 1345187587} 97 | m_Layer: 0 98 | m_Name: Main Camera 99 | m_TagString: MainCamera 100 | m_Icon: {fileID: 0} 101 | m_NavMeshLayer: 0 102 | m_StaticEditorFlags: 0 103 | m_IsActive: 1 104 | --- !u!20 &1345187587 105 | Camera: 106 | m_ObjectHideFlags: 0 107 | m_PrefabParentObject: {fileID: 0} 108 | m_PrefabInternal: {fileID: 0} 109 | m_GameObject: {fileID: 1345187583} 110 | m_Enabled: 1 111 | serializedVersion: 2 112 | m_ClearFlags: 2 113 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 114 | m_NormalizedViewPortRect: 115 | serializedVersion: 2 116 | x: 0 117 | y: 0 118 | width: 1 119 | height: 1 120 | near clip plane: 0.3 121 | far clip plane: 1000 122 | field of view: 60 123 | orthographic: 0 124 | orthographic size: 5 125 | m_Depth: -1 126 | m_CullingMask: 127 | serializedVersion: 2 128 | m_Bits: 4294967295 129 | m_RenderingPath: -1 130 | m_TargetTexture: {fileID: 0} 131 | m_TargetDisplay: 0 132 | m_TargetEye: 3 133 | m_HDR: 0 134 | m_OcclusionCulling: 1 135 | m_StereoConvergence: 10 136 | m_StereoSeparation: 0.022 137 | m_StereoMirrorMode: 0 138 | --- !u!4 &1345187588 139 | Transform: 140 | m_ObjectHideFlags: 0 141 | m_PrefabParentObject: {fileID: 0} 142 | m_PrefabInternal: {fileID: 0} 143 | m_GameObject: {fileID: 1345187583} 144 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 145 | m_LocalPosition: {x: 0, y: 1, z: -10} 146 | m_LocalScale: {x: 1, y: 1, z: 1} 147 | m_Children: [] 148 | m_Father: {fileID: 0} 149 | m_RootOrder: 0 150 | --- !u!1 &2105768337 151 | GameObject: 152 | m_ObjectHideFlags: 0 153 | m_PrefabParentObject: {fileID: 0} 154 | m_PrefabInternal: {fileID: 0} 155 | serializedVersion: 4 156 | m_Component: 157 | - 4: {fileID: 2105768339} 158 | - 114: {fileID: 2105768338} 159 | m_Layer: 0 160 | m_Name: Receiver 161 | m_TagString: Untagged 162 | m_Icon: {fileID: 0} 163 | m_NavMeshLayer: 0 164 | m_StaticEditorFlags: 0 165 | m_IsActive: 1 166 | --- !u!114 &2105768338 167 | MonoBehaviour: 168 | m_ObjectHideFlags: 0 169 | m_PrefabParentObject: {fileID: 0} 170 | m_PrefabInternal: {fileID: 0} 171 | m_GameObject: {fileID: 2105768337} 172 | m_Enabled: 1 173 | m_EditorHideFlags: 0 174 | m_Script: {fileID: 11500000, guid: bcbaaebaa014f433c95f94626ad8e16b, type: 3} 175 | m_Name: 176 | m_EditorClassIdentifier: 177 | --- !u!4 &2105768339 178 | Transform: 179 | m_ObjectHideFlags: 0 180 | m_PrefabParentObject: {fileID: 0} 181 | m_PrefabInternal: {fileID: 0} 182 | m_GameObject: {fileID: 2105768337} 183 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 184 | m_LocalPosition: {x: 0, y: 0, z: 0} 185 | m_LocalScale: {x: 1, y: 1, z: 1} 186 | m_Children: [] 187 | m_Father: {fileID: 0} 188 | m_RootOrder: 1 189 | -------------------------------------------------------------------------------- /Assets/WebGLTemplates/TestTemplate/tests.js: -------------------------------------------------------------------------------- 1 | 2 | function init_functions(unityInstance) { 3 | window.Module = unityInstance.Module; 4 | c_v = unityInstance.Module.cwrap('call_cb_v',null,[]); 5 | c_vi = unityInstance.Module.cwrap('call_cb_vi',null,['number']); 6 | c_vf = unityInstance.Module.cwrap('call_cb_vf',null,['number']); 7 | c_vs = unityInstance.Module.cwrap('call_cb_vs',null,['string']); 8 | c_vv3 = unityInstance.Module.cwrap('call_cb_vv3',null,['number']); 9 | c_vv3json = unityInstance.Module.cwrap('call_cb_vv3json',null,['string']); 10 | c_vx = unityInstance.Module.cwrap('call_cb_vx',null,['number','number','number','number']); 11 | c_vxjson = unityInstance.Module.cwrap('call_cb_vxjson',null,['string']); 12 | c_i = unityInstance.Module.cwrap('call_cb_i','number',[]); 13 | c_f = unityInstance.Module.cwrap('call_cb_f','number',[]); 14 | c_s = unityInstance.Module.cwrap('call_cb_s','string',[]); 15 | }; 16 | 17 | var iterations = 10000; 18 | 19 | var int1 = 100; 20 | var int2 = 200; 21 | var vector3 = { 22 | x:1, 23 | y:2, 24 | z:3 25 | } 26 | var vector3_2 = { 27 | x:4, 28 | y:5, 29 | z:6 30 | } 31 | 32 | function run_tests() { 33 | 34 | window.SendMessage = Module.SendMessage; 35 | 36 | console.log('Running tests via original SendMessage'); 37 | run_tests_sendmessage(); 38 | 39 | optimize_sendmessage(); 40 | console.log('Running tests via cwrap optimized SendMessage'); 41 | run_tests_sendmessage(); 42 | 43 | console.log('Running tests via direct invocations. Note: oposed to SendMessage, these calls are plain invocations of static methods. SendMessage on the other hand makes a name (string) based lookup of a dynamic GameObjects beforehands and thus is slower.'); 44 | run_tests_direct(); 45 | 46 | console.log('Running additional tests via direct invocations. These calls arent\'t directly doable with SendMessage'); 47 | run_tests_direct_additional(); 48 | } 49 | 50 | function optimize_sendmessage() { 51 | SendMessage = function(gameObject, func, param) { 52 | if (param === undefined) { 53 | if (typeof this.SendMessage_vss != 'function') 54 | this.SendMessage_vss = Module.cwrap('SendMessage', 'void', ['string', 'string']); 55 | this.SendMessage_vss(gameObject, func); 56 | } else if (typeof param === "string") { 57 | if (typeof this.SendMessage_vsss != 'function') 58 | this.SendMessage_vsss = Module.cwrap('SendMessageString', 'void', ['string', 'string', 'string']); 59 | this.SendMessage_vsss(gameObject, func, param); 60 | } else if (typeof param === "number") { 61 | if (typeof this.SendMessage_vssn != 'function') 62 | this.SendMessage_vssn = Module.cwrap('SendMessageFloat', 'void', ['string', 'string', 'number']); 63 | this.SendMessage_vssn(gameObject, func, param); 64 | } else 65 | throw "" + param + " is does not have a type which is supported by SendMessage."; 66 | } 67 | } 68 | 69 | function run_tests_sendmessage() { 70 | 71 | //---------------------- 72 | 73 | console.time('SMv'); 74 | for(i=0;i>2; 176 | Module.HEAPF32[fDataPtr] = vector3.x; 177 | Module.HEAPF32[fDataPtr+1] = vector3.y; 178 | Module.HEAPF32[fDataPtr+2] = vector3.z; 179 | c_vv3(dataPtr); 180 | Module._free(dataPtr); 181 | } 182 | console.timeEnd('Cvv3'); 183 | 184 | //---------------------- 185 | 186 | console.time('Cvx JSON'); 187 | for(i=0;i>2; 203 | Module.HEAPF32[fDataPtr] = vector3.x; 204 | Module.HEAPF32[fDataPtr+1] = vector3.y; 205 | Module.HEAPF32[fDataPtr+2] = vector3.z; 206 | 207 | Module.HEAPF32[fDataPtr+3] = vector3_2.x; 208 | Module.HEAPF32[fDataPtr+4] = vector3_2.y; 209 | Module.HEAPF32[fDataPtr+5] = vector3_2.z; 210 | 211 | c_vx(int1,int2,dataPtr,dataPtr+12); 212 | 213 | Module._free(dataPtr); 214 | } 215 | console.timeEnd('Cvx'); 216 | 217 | //---------------------- 218 | } 219 | 220 | function run_tests_direct_additional() { 221 | 222 | console.time('Ci'); 223 | for(i=0;i