userHomePath
Path to the Gradle User Home directory.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Property
- Namespace: UnityEditor.Android
- Assembly: UnityEditor.Android.Extensions
public static string userHomePath { get; set; }
Remarks
If no path is specified, the Gradle User Home directory is located in the folder of your system's home directory. If your username contains non-ASCII characters that Gradle might not process correctly, specify a custom location for your Gradle User Home directory instead of changing your username.
.gradleExamples
using UnityEngine;using UnityEditor;using UnityEditor.Android;public class GradleUserHomeManager{ [MenuItem("Build/Set Custom Gradle User Home Path")] public static void SetGradleUserHomePath() { // Example custom path to Gradle User Home directory string customUserHomePath = "/custom/gradle/home"; AndroidExternalToolsSettings.Gradle.userHomePath = customUserHomePath; Debug.Log($"Gradle User Home Path set to: {AndroidExternalToolsSettings.Gradle.userHomePath}"); } [MenuItem("Build/Reset Gradle User Home Path To Default")] public static void ResetGradleUserHomePath() { // Reset Gradle User Home path to your system's home directory. AndroidExternalToolsSettings.Gradle.userHomePath = string.Empty; Debug.Log("Gradle User Home Path reset to your system's home directory."); } [MenuItem("Build/Get Current Gradle User Home Path")] public static void GetGradleUserHomePath() { // Retrieve the currently configured Gradle User Home Path string currentUserHomePath = AndroidExternalToolsSettings.Gradle.userHomePath; Debug.Log($"Current Gradle User Home Path: {currentUserHomePath}"); }}