示例#1
0
        public static TextureOptions GetTextureOptions(Texture texture)
        {
            var assetPath = AssetDatabase.GetAssetPath(texture);
            var tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;

            if (tImporter != null)
            {
                var options = new TextureOptions();
                var type    = tImporter.textureType;
                options.sRGBTexture           = type == TextureImporterType.Default ? tImporter.sRGBTexture : false;
                options.filterMode            = tImporter.filterMode;
                options.wrapMode              = tImporter.wrapMode;
                options.mipmapEnabled         = tImporter.mipmapEnabled;
                options.textureImporterFormat = tImporter.GetAutomaticFormat("Standalone");
                return(options);
            }

            // Default texture options.
            return(new TextureOptions()
            {
                filterMode = FilterMode.Trilinear,
                mipmapEnabled = true,
                sRGBTexture = true,
                textureImporterFormat = null,
                wrapMode = TextureWrapMode.Repeat
            });
        }
示例#2
0
        public static TextureOptions GetTextureOptions(Texture texture)
        {
            var assetPath = AssetDatabase.GetAssetPath(texture);
            var tImporter = AssetImporter.GetAtPath(assetPath) as TextureImporter;

            if (tImporter != null)
            {
                var options = new TextureOptions();
                var type    = tImporter.textureType;
                options.sRGBTexture   = type == TextureImporterType.Default ? tImporter.sRGBTexture : false;
                options.filterMode    = tImporter.filterMode;
                options.wrapMode      = tImporter.wrapMode;
                options.mipmapEnabled = tImporter.mipmapEnabled;
                return(options);
            }

            return(null);
        }