private static T LocateAssetFile <T>() where T : UnityEngine.Object { T assetObject; string newAssetFilePath = EditorUtility.OpenFilePanel( "Couldn't find asset at " + fileAssetPath + ". Select correct file.", Path.Combine(Path.GetDirectoryName(Application.dataPath), "Assets"), ""); fileAssetPath = UrdfAssetDatabase.GetAssetPathFromAbsolutePath(newAssetFilePath); assetObject = (T)AssetDatabase.LoadAssetAtPath(fileAssetPath, typeof(T)); return(assetObject); }
private static T LocateRootAssetFolder <T>(string assetFileName) where T : UnityEngine.Object { T assetObject; string newAssetPath = EditorUtility.OpenFolderPanel( "Locate package root folder", Path.Combine(Path.GetDirectoryName(Application.dataPath), "Assets"), ""); UrdfAssetDatabase.UpdateAssetPath(UrdfAssetDatabase.GetAssetPathFromAbsolutePath(newAssetPath)); fileAssetPath = UrdfAssetDatabase.GetAssetPathFromPackagePath(assetFileName); assetObject = (T)AssetDatabase.LoadAssetAtPath(fileAssetPath, typeof(T)); return(assetObject); }