//[MenuItem("HandMR/Add Packages to PackageManager")] static void loadPackages() { LoadPackages loadPackage = new LoadPackages(); bool isChange = false; isChange |= loadPackage.addPackageManager("com.unity.xr.management", "4.0.1"); isChange |= loadPackage.addPackageManager("com.unity.xr.arfoundation", "4.1.7"); isChange |= loadPackage.addPackageManager("com.unity.xr.arsubsystems", "4.1.7"); isChange |= loadPackage.addPackageManager("com.unity.xr.arcore", "4.1.7"); isChange |= loadPackage.addPackageManager("com.unity.xr.arkit", "4.1.7"); isChange |= loadPackage.addPackageManager("com.unity.inputsystem", "1.0.2"); AssetDatabase.Refresh(); while (string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID("ProjectSettings/ProjectSettings.asset"))) { System.Threading.Thread.Sleep(16); AssetDatabase.Refresh(); } SetScriptingDefineSymbol("DOWNLOADED_ARFOUNDATION"); AssetDatabase.SaveAssets(); if (isChange) { Debug.Log("Add packages is finished."); } }
void OnGUI() { var currentPosition = position; currentPosition.width = 350f; currentPosition.height = 600f; position = currentPosition; GUILayout.Label("Step 1. Add Packages to PackageManager"); if (GUILayout.Button("Execute")) { loadPackages(); } GUILayout.Label("Step 2. Setting Project, Layers and Prefabs"); if (GUILayout.Button("Execute")) { initSettings(); } GUILayout.Label("Step 3. Setting XR"); GUILayout.Label(" 1. Open Project Settings -> XR-Plugin Management."); GUILayout.Label(" 2. Put check(s) ARCore (for Android) and/or ARKit (for iOS)."); GUILayout.Label(" 3. Open Project Settings -> Player."); GUILayout.Label(" 4. Change 'Active Input Handling' to 'Both'."); if (GUILayout.Button("Open Project Settings")) { EditorApplication.ExecuteMenuItem("Edit/Project Settings..."); } GUILayout.Label("Step 4. Copy Setting Files for Android Plugins"); if (GUILayout.Button("Execute")) { if (!Directory.Exists("Assets/Plugins")) { AssetDatabase.CreateFolder("Assets", "Plugins"); } if (!Directory.Exists("Assets/Plugins/Android")) { AssetDatabase.CreateFolder("Assets/Plugins", "Android"); } AssetDatabase.CopyAsset("Assets/HandMR/Plugins/Android/mainTemplate.gradle", "Assets/Plugins/Android/mainTemplate.gradle"); AssetDatabase.CopyAsset("Assets/HandMR/Plugins/Android/gradleTemplate.properties", "Assets/Plugins/Android/gradleTemplate.properties"); Debug.Log("Finish copy files."); } GUILayout.Label("Step 5. Download and Install iOS Plugins"); if (GUILayout.Button("Execute")) { HandMRSceneInitializer.InitProjectForIOS(); } GUILayout.Label("Step 6. Select Languages"); var newLang = (ChangeLanguage.Languages)EditorGUILayout.EnumPopup(lang_); if (newLang != lang_) { ChangeLanguage.Change(lang_, newLang); lang_ = newLang; } GUILayout.Label("Step 7. Debug Settings (Optional)"); GUILayout.Label(" 1. Install 'AR Foundation Remote 2.0'."); if (GUILayout.Button("Go to Asset Store Page")) { Application.OpenURL("https://assetstore.unity.com/packages/tools/utilities/ar-foundation-remote-2-0-201106"); } GUILayout.Label(" 2. Copy model files for debugging."); if (GUILayout.Button("Execute")) { Directory.CreateDirectory("mediapipe/modules/hand_landmark"); File.Copy(Application.dataPath + "/HandMR/SubAssets/HandVR/EditorModels/hand_landmark_lite.tflite", "mediapipe/modules/hand_landmark/hand_landmark_lite.tflite", true); File.Copy(Application.dataPath + "/HandMR/SubAssets/HandVR/EditorModels/handedness.txt", "mediapipe/modules/hand_landmark/handedness.txt", true); Directory.CreateDirectory("mediapipe/modules/palm_detection"); File.Copy(Application.dataPath + "/HandMR/SubAssets/HandVR/EditorModels/palm_detection_lite.tflite", "mediapipe/modules/palm_detection/palm_detection_lite.tflite", true); File.Copy(Application.dataPath + "/HandMR/SubAssets/HandVR/EditorModels/keypoint_classifier.tflite", "keypoint_classifier.tflite", true); Debug.Log("Finish copy files."); } GUILayout.Label("Step 8. URP Settings (Optional)"); GUILayout.Label(" If you use URP, click button."); if (GUILayout.Button("Execute")) { LoadPackages loadPackage = new LoadPackages(); loadPackage.addPackageManager("com.unity.render-pipelines.universal", "10.5.1"); SetScriptingDefineSymbol("ENABLE_URP"); Debug.Log("Setting is finished."); } GUILayout.Space(20); isNotShowAgain_ = GUILayout.Toggle(isNotShowAgain_, "Do not show again"); if (GUILayout.Button("Close")) { Close(); } }