using UnityEngine; public class WebViewInfo : MonoBehaviourSingletonTemplate { public GameObject go_closeBtn; WebViewObject webViewObject; // 시작 위치에서 오른쪽으로 이동할 거리 (픽셀 단위) private float offsetX = 75f; public void Show_WebView(string _url) { go_closeBtn.SetActive(true); webViewObject = new GameObject("gree").AddComponent(); webViewObject.transform.parent = transform; webViewObject.transform.localPosition = Vector3.zero; var screenval = Screen.height > Screen.width ? Screen.height : Screen.width; int margin = (int)(screenval * 0.5f); // 화면의 절반인데 오른쪽에 보이기 #if !UNITY_EDITOR webViewObject.Init(separated: true, enableWKWebView: true); webViewObject.SetMargins(margin, 0, 0, 0); webViewObject.LoadURL(_url); webViewObject.SetVisibility(true); #endif return; // 아래는 75픽셀 정도 빼고 화면 전체로 보이기 margin = (int)Mathf.Max(offsetX, offsetX * screenval / 1280); #if !UNITY_EDITOR webViewObject.Init(separated: true, enableWKWebView: true); webViewObject.SetMargins(0, 0, margin, 0); webViewObject.LoadURL(_url); webViewObject.SetVisibility(true); #endif } public void OnClick_Close() { if (webViewObject != null) Destroy(webViewObject.gameObject); go_closeBtn.SetActive(false); } }