You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingSystem;usingUnityEngine;namespaceVRMShaders{publicsealedclassRuntimeTextureSerializer:ITextureSerializer{publicboolCanExportAsEditorAssetFile(Texturetexture,ColorSpaceexportColorSpace){returnfalse;}public(byte[]bytes,stringmime)ExportBytesWithMime(Texture2Dtexture,ColorSpaceexportColorSpace){try{varjpg=texture.EncodeToJPG();if(jpg!=null){return(jpg,"image/jpg");}else{// Failed, because texture is compressed.// ex. ".DDS" file, or Compression is enabled in Texture Import Settings.returnCopyTextureAndGetBytesWithMime(texture,exportColorSpace);}}catch(ArgumentExceptionex){// System.ArgumentException: not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.// Failed, because texture is not readable.Debug.LogWarning(ex);// 単純に EncodeToPNG できないため、コピーしてから EncodeToPNG する。returnCopyTextureAndGetBytesWithMime(texture,exportColorSpace);}}publicvoidModifyTextureAssetBeforeExporting(Texturetexture){// NOTE: Do nothing.}privatestatic(byte[]bytes,stringmime)CopyTextureAndGetBytesWithMime(Texture2Dtexture,ColorSpacecolorSpace){varneedsAlpha=texture.format!=TextureFormat.RGB24;varcopiedTex=TextureConverter.CopyTexture(texture,colorSpace,needsAlpha,null);varbytes=copiedTex.EncodeToJPG();if(Application.isPlaying){UnityEngine.Object.Destroy(copiedTex);}else{UnityEngine.Object.DestroyImmediate(copiedTex);}return(bytes,"image/jpg");}}}
I changed every PNG to JPG and it worked
The text was updated successfully, but these errors were encountered:
if updated it will break
I changed every PNG to JPG and it worked
The text was updated successfully, but these errors were encountered: