Ejemplo n.º 1
0
        /// <summary>
        /// Creates an asset of the specified type, using a Save File Panel to define the path to that new asset.
        /// </summary>
        /// <typeparam name="TAssetType">The type of the Scriptable Object to create.</param>
        /// <param name="_PanelTitle">Title of the panel window</param>
        /// <param name="_CreatedAsset">The created asset</param>
        /// <param name="_FileName">The asset file's name. If empty, the asset name will be New[_AssetType]</param>
        /// <param name="_DefaultPath">Path to focus when the panel will open</param>
        /// <param name="_FileExtension">The asset file's extension</param>
        /// <param name="_FocusAsset">Should the asset be selected and highlighted after its creation ?</param>
        public static AssetCreationResult CreateAssetPanel <TAssetType>
        (
            out TAssetType _CreatedAsset,
            string _PanelTitle,
            string _FileName      = "",
            string _DefaultPath   = "",
            string _FileExtension = DEFAULT_ASSET_EXTENSION,
            bool _FocusAsset      = true
        )
            where TAssetType : Object
        {
            AssetCreationResult result = CreateAssetPanel
                                         (
                typeof(TAssetType),
                _PanelTitle,
                _FileName,
                _DefaultPath,
                _FileExtension,
                _FocusAsset
                                         );

            _CreatedAsset = result.AssetObject ? result.AssetObject as TAssetType : null;
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an asset of the given type, using a Save File Panel to define the path to that new asset.
        /// </summary>
        /// <param name="_AssetType">The type of the asset to create</param>
        /// <param name="_CreatedAsset">The created asset</param>
        /// <param name="_PanelTitle">Title of the panel window</param>
        /// <param name="_FileName">The asset file's name. If empty, the asset name will be New[_AssetType]</param>
        /// <param name="_DefaultPath">Path to focus when the panel will open</param>
        /// <param name="_FileExtension">The asset file's extension</param>
        /// <param name="_FocusAsset">Should the asset be selected and highlighted after its creation ?</param>
        public static AssetCreationResult CreateAssetPanel
        (
            Type _AssetType,
            out Object _CreatedAsset,
            string _PanelTitle    = "Save new asset",
            string _FileName      = "",
            string _DefaultPath   = "",
            string _FileExtension = DEFAULT_ASSET_EXTENSION,
            bool _FocusAsset      = true
        )
        {
            AssetCreationResult result = CreateAssetPanel
                                         (
                _AssetType,
                _PanelTitle,
                _FileName,
                _DefaultPath,
                _FileExtension,
                _FocusAsset
                                         );

            _CreatedAsset = result.AssetObject;
            return(result);
        }