Unity3D AR Foundation === ###### tags: `Unity3D` ## 目錄 [TOC] ## :memo: Unity3D ### Package Manager #### Windows > Package Manager * ARKit Face Tracking * ARKit XR Plugin * AR Foundation * ARCore XR Plugin ![](https://i.imgur.com/PXAhxcZ.png) ------ ### Import Package ![](https://i.imgur.com/XI9D4wp.png) ![](https://i.imgur.com/9wxGX2h.png) ------ ### AR Foundation 基本場景物件 * AR Session Origin * AR Session ![](https://i.imgur.com/XaAYhTC.png) ![](https://i.imgur.com/ycdMX0c.jpg) #### 快速教學範例影片 {%youtube OydZM5MXLic%} ------ ### Build Settings #### Project Settings > Player > Other Settings #### 把 Vulkan 刪除 ![](https://i.imgur.com/SdkqdPJ.png) #### 選擇 API level 25 以上 ![](https://i.imgur.com/5Yx0M4k.png) #### Project Settings > Player > XR Plug-in Management #### Android 勾選 ARCore ![](https://i.imgur.com/1sAds9c.png) ------ ### Gpm WebView ### [Game Package Manager](https://assetstore.unity.com/packages/tools/utilities/game-package-manager-147711) ![](https://i.imgur.com/632VqY7.png) ![](https://i.imgur.com/CrZNotL.png) ![](https://i.imgur.com/4pNg0y8.png) ```csharp= using Gpm.WebView; public void ShowUrl(string uuid) { // GlassesAPI.aspx.168/GlassesAPI.aspx?uuid=123 string WebURL = "GlassesAPI.aspx.168/GlassesAPI.aspx" + "?uuid=" + uuid; GpmWebView.ShowUrl( WebURL, new GpmWebViewRequest.Configuration() { style = GpmWebViewStyle.FULLSCREEN, isClearCookie = false, isClearCache = false, isNavigationBarVisible = false, //navigationBarColor = "#4B96E6", //title = "ACME", isBackButtonVisible = true, isForwardButtonVisible = true, #if UNITY_IOS contentMode = GpmWebViewContentMode.MOBILE #elif UNITY_ANDROID supportMultipleWindows = true #endif }, OnOpenCallback, OnCloseCallback, OnPageLoadCallback, new List<string>() { "USER_ CUSTOM_SCHEME" }, OnSchemeEvent ); } private void OnOpenCallback(GpmWebViewError error) { if (error == null) { Debug.Log("Open WebView Success"); } else { Debug.LogFormat("Fail to open WebView. Error:{0}", error); } } private void OnCloseCallback(GpmWebViewError error) { if (error == null) { Debug.Log("Close WebView Success"); } else { Debug.LogFormat("Fail to close WebView. Error:{0}", error); } } private void OnSchemeEvent(string data, GpmWebViewError error) { if (error == null) { Debug.LogFormat("Scheme:{0}", data); } } private void OnPageLoadCallback(string url) { if (string.IsNullOrEmpty(url) == false) { Debug.LogFormat("Loaded Page:{0}", url); } } ```