Ejemplo n.º 1
0
        public static void CreateTestPng(string childPath, string fileName, TextureColor color)
        {
            var path      = UnityPathUtility.GetUnityAbsoluteFullPath(childPath, fileName, GetExtension(FileType.Png));
            var texture2D = Texture2D.normalTexture;

            switch (color)
            {
            case TextureColor.black:
                texture2D = Texture2D.blackTexture;
                break;

            case TextureColor.white:
                texture2D = Texture2D.whiteTexture;
                break;

            default:
                texture2D = Texture2D.normalTexture;
                break;
            }

            var bytes = texture2D.EncodeToPNG();

            File.WriteAllBytes(path, bytes);
            RefreshAsset();
        }
Ejemplo n.º 2
0
        public static void CreatePng(string childPath, string fileName)
        {
            var path      = UnityPathUtility.GetUnityAbsoluteFullPath(childPath, fileName, GetExtension(FileType.Png));
            var texture2D = Texture2D.blackTexture;
            var bytes     = texture2D.EncodeToPNG();

            File.WriteAllBytes(path, bytes);
            RefreshAsset();
        }