Esempio n. 1
0
        /// <summary>
        /// Create a copy of this profile at the specified path
        /// </summary>
        /// <param name="rNewPath"></param>
        /// <returns></returns>
        public CharacterWizardProfile Copy(string rNewPath = "")
        {
            CharacterWizardProfile lCopiedProfile = null;

            try
            {
                string lNewPath = string.IsNullOrEmpty(rNewPath)
                    ? AssetHelper.GetNewAssetPath(AssetPath)
                    : AssetHelper.GetNewAssetPath(rNewPath);

                if (!lNewPath.EndsWith(".asset"))
                {
                    lNewPath += ".asset";
                }

                if (!File.Exists(lNewPath))
                {
                    AssetDatabase.CopyAsset(AssetPath, lNewPath);
                }

                lCopiedProfile = AssetDatabase.LoadAssetAtPath <CharacterWizardProfile>(lNewPath);
                if (lCopiedProfile != null)
                {
                    // Ensure that the copied profile is set up for user editing
                    lCopiedProfile.ReadOnly = false;
                    lCopiedProfile.Priority = PriorityStatus.User;
                    lCopiedProfile._Renamed = false;
                }
                return(lCopiedProfile);
            }
            catch (IOException ex)
            {
                Debug.LogException(ex);
            }

            return(lCopiedProfile);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new profile at the specified path
        /// </summary>
        /// <param name="rPath"></param>
        /// <returns></returns>
        public static CharacterWizardProfile Create(string rPath)
        {
            string lPath = AssetHelper.GetNewAssetPath(rPath);

            return(AssetHelper.GetOrCreateAsset <CharacterWizardProfile>(lPath));
        }