コード例 #1
0
        private static void Decompress()
        {
#if IO_UNSUPPORTED_PLATFORM
            Debug.LogWarning("[Zip] Not supported.");
#else
            string   _zippedFilePath = AssetDatabaseUtils.GUIDToAssetAbsolutePath(Selection.assetGUIDs[0]);
            FileInfo _fileInfo       = new FileInfo(_zippedFilePath);

            DecompressToDirectory(_zippedFilePath, _fileInfo.Directory.FullName, (string _outputMessage) => {
                Console.WriteLine(_outputMessage);
            });
#endif
        }
コード例 #2
0
        private static bool DecompressValidation()
        {
            string[] _guids = Selection.assetGUIDs;

            if (_guids.Length <= 0)
            {
                return(false);
            }

            string _selectedFilePath = AssetDatabaseUtils.GUIDToAssetAbsolutePath(_guids[0]);
            string _fileExtension    = Path.GetExtension(_selectedFilePath);

            if (_fileExtension == null)
            {
                return(false);
            }

            return(_fileExtension.Equals(".gz"));
        }
コード例 #3
0
        private static void MoveExistingAssetsTemp()
        {
            string _oldPath = "Assets/Resources/VoxelBusters";
            string _newPath = "Assets/Resources/SharedAssets";

            // check whether destination folder exists
            if (!AssetDatabase.IsValidFolder(_newPath))
            {
                AssetDatabaseUtils.CreateFolder(_newPath);
            }

            // parse through the assets and move it to destination folder
            if (AssetDatabase.IsValidFolder(_oldPath))
            {
                string[] _assetIDs = AssetDatabase.FindAssets("t: ScriptableObject", new string[] { _oldPath });
                foreach (string _assetID in _assetIDs)
                {
                    string _sourcePath = AssetDatabase.GUIDToAssetPath(_assetID);
                    string _fileName   = Path.GetFileName(_sourcePath);

                    AssetDatabase.MoveAsset(_sourcePath, _newPath + "/" + _fileName);
                }
            }
        }