Ejemplo n.º 1
0
		/// <summary>
		/// Given relative path to an asset (with Assets/ in the path), this returns the full path to it.
		/// </summary>
		/// <param name="inAssetRelativePath">Relative path to parse</param>
		/// <returns>Returns full path to asset, or null if invalid input path</returns>
		public static string GetAssetFullPath(string inAssetRelativePath)
		{
			string replaceOld = GetAssetRelativePathStart();
			string replaceNew = Application.dataPath + HEU_Platform.DirectorySeparatorStr;
			//Debug.LogFormat("Replacing relative {0} with full {1}", inAssetRelativePath, inAssetRelativePath.Replace(replaceOld, replaceNew));
			if (IsPathRelativeToAssets(inAssetRelativePath))
			{
				return HEU_GeneralUtility.ReplaceFirstOccurrence(inAssetRelativePath, replaceOld, replaceNew);
			}
			else
			{
				Debug.LogWarningFormat("Given relative path {0} does not start with {1}. Unable to create full path!", inAssetRelativePath, replaceOld);
				return null;
			}
		}