AssetSetReadWriteEnabled() public static method

Sets the asset Read/Write enabled state.
public static AssetSetReadWriteEnabled ( string path, bool enabled, bool force ) : bool
path string Path.
enabled bool If set to true enabled.
force bool If set to true force.
return bool
Esempio n. 1
0
        /// <summary>
        /// Sets the assets read write enabled.
        /// </summary>
        /// <returns><c>true</c>, if assets read write enabled was set, <c>false</c> otherwise.</returns>
        /// <param name="assetPaths">Asset paths.</param>
        /// <param name="enabled">If set to <c>true</c> enabled.</param>
        protected bool SetAssetsReadWriteEnabled(string[] assetPaths, bool enabled)
        {
            bool success = true;

            // Make the assets readable
            foreach (string assetPath in assetPaths)
            {
                // Make the texture readable
                if (!SPTools.AssetSetReadWriteEnabled(assetPath, enabled, false))
                {
                    Debug.LogWarning("Sprite Packer failed to set Read/Write state (" + enabled.ToString() + ") on asset: " + assetPath);
                    success = false;
                }
            }

            // Return the result
            return(success);
        }
Esempio n. 2
0
 /// <summary>
 /// Sets the texture asset Read/Write enabled state.
 /// </summary>
 /// <returns><c>true</c>, if set read write enabled was textured, <c>false</c> otherwise.</returns>
 /// <param name="texture">Texture.</param>
 /// <param name="enabled">If set to <c>true</c> enabled.</param>
 /// <param name="force">If set to <c>true</c> force.</param>
 public static bool TextureSetReadWriteEnabled(Texture2D texture, bool enabled, bool force)
 {
     return(SPTools.AssetSetReadWriteEnabled(SPTools.GetAssetPath(texture), enabled, force));
 }