├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── EditorBuildSettings.asset ├── NetworkManager.asset ├── TimeManager.asset ├── AudioManager.asset ├── TagManager.asset ├── EditorSettings.asset ├── UnityConnectSettings.asset ├── DynamicsManager.asset ├── Physics2DSettings.asset ├── NavMeshAreas.asset ├── GraphicsSettings.asset ├── QualitySettings.asset ├── InputManager.asset └── ProjectSettings.asset ├── .gitignore ├── Assets ├── Scenes │ ├── pluginTest.unity.meta │ └── pluginTest.unity ├── Plugins.meta ├── Scenes.meta ├── Scripts.meta ├── Plugins │ ├── iOS.meta │ └── iOS │ │ ├── MyPlugin.mm.meta │ │ └── MyPlugin.mm └── Scripts │ ├── PluginTest.cs.meta │ ├── SpinCube.cs.meta │ ├── SpinCube.cs │ └── PluginTest.cs └── README.md /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2017.3.0f3 2 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !*.zip 2 | !*.dll 3 | !*.jar 4 | !*.java 5 | .DS_Store 6 | Library 7 | Temp 8 | *.csproj 9 | *.pidb 10 | *.unityproj 11 | *.sln 12 | *.userprefs 13 | *.apk 14 | .vs 15 | iosBuild 16 | UnityPackageManager 17 | obj 18 | Screenshots 19 | 20 | 21 | -------------------------------------------------------------------------------- /Assets/Scenes/pluginTest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04e4a3bdf69704cf4a7c07252a0d9a3b 3 | timeCreated: 1517093411 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eddf2c5e5e52d4825ae5a1cca0c3c773 3 | folderAsset: yes 4 | timeCreated: 1517078851 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a24f76d6fecd34d9fbe00e80fce476db 3 | folderAsset: yes 4 | timeCreated: 1517078844 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7519cfb1b175c4baf86d720a9d1829f3 3 | folderAsset: yes 4 | timeCreated: 1517078839 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Assets/Plugins/iOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e49ce81b30d2444319aa1ce900f0a184 3 | folderAsset: yes 4 | timeCreated: 1517078860 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Scripts/PluginTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a269a3f04d9240e0bf866769cbb0843 3 | timeCreated: 1517079048 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Scripts/SpinCube.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db4f30af47d114603948babacc7518a4 3 | timeCreated: 1517079037 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Scripts/SpinCube.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class SpinCube : MonoBehaviour { 6 | 7 | public float speed = 30f; 8 | // Use this for initialization 9 | void Start () { 10 | 11 | } 12 | 13 | // Update is called once per frame 14 | void Update () { 15 | 16 | transform.Rotate(speed*Time.deltaTime,2*speed*Time.deltaTime,-speed*Time.deltaTime); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /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_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOSUnityWebView 2 | 3 | This tutorial explains how to extend my base plugin with an OpenWebView method, allowing an iOS WKWebView to be created, loaded, and then displayed and interacted with on top of Unity. 4 | 5 | This tutorial creates a WKWebView and then adjusts its frame to allow for a blank space at the top of the layout, so some portion of the Unity screen is still visible and can be interacted with. 6 | 7 | The video for this tutorial can be found at: 8 | 9 | https://youtu.be/nA8EAP2tylE 10 | 11 | @cwgtech 12 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/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: 7 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 1 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/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: 7 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /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: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Assets/Plugins/iOS/MyPlugin.mm.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6589920871fe4237958e8278e6626aa 3 | timeCreated: 1517093286 4 | licenseType: Pro 5 | PluginImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | iconMap: {} 9 | executionOrder: {} 10 | isPreloaded: 0 11 | isOverridable: 0 12 | platformData: 13 | - first: 14 | '': Any 15 | second: 16 | enabled: 0 17 | settings: 18 | Exclude Android: 1 19 | Exclude Editor: 1 20 | Exclude Linux: 1 21 | Exclude Linux64: 1 22 | Exclude LinuxUniversal: 1 23 | Exclude OSXUniversal: 1 24 | Exclude WebGL: 1 25 | Exclude Win: 1 26 | Exclude Win64: 1 27 | Exclude iOS: 0 28 | Exclude tvOS: 1 29 | - first: 30 | Android: Android 31 | second: 32 | enabled: 0 33 | settings: 34 | CPU: ARMv7 35 | - first: 36 | Any: 37 | second: 38 | enabled: 0 39 | settings: {} 40 | - first: 41 | Editor: Editor 42 | second: 43 | enabled: 0 44 | settings: 45 | CPU: AnyCPU 46 | DefaultValueInitialized: true 47 | OS: AnyOS 48 | - first: 49 | Facebook: Win 50 | second: 51 | enabled: 0 52 | settings: 53 | CPU: AnyCPU 54 | - first: 55 | Facebook: Win64 56 | second: 57 | enabled: 0 58 | settings: 59 | CPU: AnyCPU 60 | - first: 61 | Standalone: Linux 62 | second: 63 | enabled: 0 64 | settings: 65 | CPU: x86 66 | - first: 67 | Standalone: Linux64 68 | second: 69 | enabled: 0 70 | settings: 71 | CPU: x86_64 72 | - first: 73 | Standalone: OSXUniversal 74 | second: 75 | enabled: 0 76 | settings: 77 | CPU: AnyCPU 78 | - first: 79 | Standalone: Win 80 | second: 81 | enabled: 0 82 | settings: 83 | CPU: AnyCPU 84 | - first: 85 | Standalone: Win64 86 | second: 87 | enabled: 0 88 | settings: 89 | CPU: AnyCPU 90 | - first: 91 | iPhone: iOS 92 | second: 93 | enabled: 1 94 | settings: 95 | CompileFlags: 96 | FrameworkDependencies: WebKit; 97 | - first: 98 | tvOS: tvOS 99 | second: 100 | enabled: 0 101 | settings: 102 | CompileFlags: 103 | FrameworkDependencies: 104 | userData: 105 | assetBundleName: 106 | assetBundleVariant: 107 | -------------------------------------------------------------------------------- /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: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /Assets/Scripts/PluginTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | 7 | public class PluginTest : MonoBehaviour 8 | { 9 | 10 | #if UNITY_IOS 11 | 12 | private delegate void intCallback(int result); 13 | 14 | [DllImport("__Internal")] 15 | private static extern double IOSgetElapsedTime(); 16 | 17 | [DllImport("__Internal")] 18 | private static extern void IOScreateNativeAlert(string[] strings, int stringCount, intCallback callback); 19 | 20 | [DllImport("__Internal")] 21 | private static extern void IOSshareScreenImage(byte[] imagePNG, long imageLen, string caption, intCallback callback); 22 | 23 | [DllImport("__Internal")] 24 | private static extern void IOSshowWebView(string URL, int pixelSpace); 25 | 26 | [DllImport("__Internal")] 27 | private static extern void IOShideWebView(intCallback callback); 28 | 29 | 30 | #endif 31 | 32 | public Button shareButton; 33 | 34 | public RectTransform webPanel; 35 | public RectTransform buttonStrip; 36 | 37 | // Use this for initialization 38 | void Start() 39 | { 40 | 41 | Debug.Log("Elapsed Time: " + getElapsedTime()); 42 | //StartCoroutine(ShowDialog(Random.Range(7,12))); 43 | } 44 | 45 | IEnumerator ShowDialog(float delayTime) 46 | { 47 | Debug.Log("Will show alert after " + delayTime + " seconds"); 48 | if (delayTime > 0) 49 | yield return new WaitForSeconds(delayTime); 50 | CreateIOSAlert(new string[] { "Title", "Message", "DefaultButton", "OtherButton" }); 51 | } 52 | 53 | 54 | double getElapsedTime() 55 | { 56 | if (Application.platform == RuntimePlatform.IPhonePlayer) 57 | return IOSgetElapsedTime(); 58 | Debug.LogWarning("Wrong platform!"); 59 | return 0; 60 | } 61 | 62 | [AOT.MonoPInvokeCallback(typeof(intCallback))] 63 | static void nativeAlertHandler(int result) 64 | { 65 | Debug.Log("Unity: clicked button at index: " + result); 66 | } 67 | 68 | public void CreateIOSAlert(string[] strings) 69 | { 70 | if (strings.Length < 3) 71 | { 72 | Debug.LogError("Alert requires at least 3 strings!"); 73 | return; 74 | } 75 | 76 | if (Application.platform == RuntimePlatform.IPhonePlayer) 77 | IOScreateNativeAlert(strings, strings.Length, nativeAlertHandler); 78 | else 79 | Debug.LogWarning("Can only display alert on iOS"); 80 | Debug.Log("Alert shown after: " + getElapsedTime() + " seconds"); 81 | } 82 | 83 | public void ShareScreenTapped() 84 | { 85 | if (shareButton != null) 86 | shareButton.gameObject.SetActive(false); 87 | ShareScreenShot(Application.productName + " screenshot", (int result) => 88 | { 89 | Debug.Log("Share completed with: " + result); 90 | CreateIOSAlert(new string[] { "Share Complete", "Share completed with: " + result, "OK" }); 91 | if (shareButton != null) 92 | shareButton.gameObject.SetActive(true); 93 | }); 94 | 95 | } 96 | 97 | static System.Action ShareCompleteAction; 98 | 99 | static bool isSharingScreenShot; 100 | 101 | [AOT.MonoPInvokeCallback(typeof(intCallback))] 102 | static void shareCallback(int result) 103 | { 104 | Debug.Log("Unity: share completed with: " + result); 105 | if (ShareCompleteAction != null) 106 | ShareCompleteAction(result); 107 | isSharingScreenShot = false; 108 | } 109 | 110 | public void ShareScreenShot(string caption, System.Action shareComplete) 111 | { 112 | if (isSharingScreenShot) 113 | { 114 | Debug.LogError("already sharing screenshot - aborting"); 115 | return; 116 | } 117 | isSharingScreenShot = true; 118 | ShareCompleteAction = shareComplete; 119 | StartCoroutine(waitForEndOfFrame(caption)); 120 | } 121 | 122 | IEnumerator waitForEndOfFrame(string caption) 123 | { 124 | yield return new WaitForEndOfFrame(); 125 | Texture2D image = ScreenCapture.CaptureScreenshotAsTexture(); 126 | Debug.Log("Image size: " + image.width + " x " + image.height); 127 | byte[] imagePNG = image.EncodeToPNG(); 128 | Debug.Log("PNG size: " + imagePNG.Length); 129 | if (Application.platform == RuntimePlatform.IPhonePlayer) 130 | IOSshareScreenImage(imagePNG, imagePNG.Length, caption, shareCallback); 131 | Object.Destroy(image); 132 | } 133 | 134 | public void OpenWebView(string url, int pixelShift) 135 | { 136 | if (Application.platform == RuntimePlatform.IPhonePlayer) 137 | { 138 | IOSshowWebView(url, pixelShift); 139 | } 140 | } 141 | 142 | public void CloseWebView(System.Action closeComplete) 143 | { 144 | onCloseWebView = closeComplete; 145 | if (Application.platform == RuntimePlatform.IPhonePlayer) 146 | { 147 | IOShideWebView(closeWebViewHandler); 148 | } 149 | else 150 | closeWebViewHandler(0); 151 | } 152 | 153 | [AOT.MonoPInvokeCallback(typeof(intCallback))] 154 | static void closeWebViewHandler(int result) 155 | { 156 | if (onCloseWebView != null) 157 | onCloseWebView(result); 158 | onCloseWebView = null; 159 | } 160 | static System.Action onCloseWebView; 161 | 162 | 163 | 164 | public void OpenWebViewTapped() 165 | { 166 | Canvas parentCanvas = buttonStrip.GetComponentInParent(); 167 | int stripHeight = (int)(buttonStrip.rect.height * parentCanvas.scaleFactor + 0.5f); 168 | webPanel.gameObject.SetActive(true); 169 | OpenWebView("http://www.cwgtech.com", stripHeight); 170 | } 171 | 172 | public void CloseWebViewTapped() 173 | { 174 | CloseWebView((int result) => 175 | { 176 | webPanel.gameObject.SetActive(false); 177 | }); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Standalone: 5 185 | Tizen: 2 186 | WebGL: 3 187 | WiiU: 5 188 | Windows Store Apps: 5 189 | XboxOne: 5 190 | iPhone: 2 191 | tvOS: 2 192 | -------------------------------------------------------------------------------- /Assets/Plugins/iOS/MyPlugin.mm: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | typedef void (*INT_CALLBACK)(int); 6 | 7 | @interface MyPlugin: NSObject 8 | { 9 | INT_CALLBACK alertCallBack; 10 | NSDate *creationDate; 11 | INT_CALLBACK shareCallBack; 12 | UIPopoverController *popover; 13 | WKWebView *webView; 14 | } 15 | @end 16 | 17 | @implementation MyPlugin 18 | 19 | static MyPlugin *_sharedInstance; 20 | 21 | +(MyPlugin*) sharedInstance 22 | { 23 | static dispatch_once_t onceToken; 24 | dispatch_once(&onceToken, ^{ 25 | NSLog(@"Creating MyPlugin shared instance"); 26 | _sharedInstance = [[MyPlugin alloc] init]; 27 | }); 28 | return _sharedInstance; 29 | } 30 | 31 | +(NSString*)createNSString:(const char*) string { 32 | if (string!=nil) 33 | return [NSString stringWithUTF8String:string]; 34 | else 35 | return @""; 36 | } 37 | 38 | -(id)init 39 | { 40 | self = [super init]; 41 | if (self) 42 | [self initHelper]; 43 | return self; 44 | } 45 | 46 | -(void)initHelper 47 | { 48 | NSLog(@"InitHelper called"); 49 | creationDate = [NSDate date]; 50 | } 51 | 52 | -(double)getElapsedTime 53 | { 54 | return [[NSDate date] timeIntervalSinceDate:creationDate]; 55 | } 56 | 57 | -(void)createAlertDialog:(const char**) strings_in stringCount:(int)stringCount callback:(INT_CALLBACK)callback 58 | { 59 | NSMutableArray *strings = [NSMutableArray new]; 60 | for (int ix=0;ix0) 63 | [strings addObject:[MyPlugin createNSString:strings_in[ix]]]; 64 | } 65 | stringCount = (int)[strings count]; 66 | 67 | UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:strings[0] message:strings[1] delegate:self cancelButtonTitle:strings[2] otherButtonTitles:nil]; 68 | if (stringCount>3) 69 | { 70 | int ix = 3; 71 | while (ix