Skip to content

Commit

Permalink
fix incorrect ifdef in texture conversion warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Aug 11, 2022
1 parent 84d7a68 commit 8dd9890
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ private static bool ConvertStandardAndURPLit(Material material, Shader oldShader

material.SetFloat(metallicFactor, metallic);
material.SetFloat(roughnessFactor, 1 - smoothness);
const string ConversionWarning = "The Metallic (R) Smoothness (A) texture needs to be converted to Roughness (B) Metallic (G). ";
#if UNITY_EDITOR && UNITY_2022_1_OR_NEWER
var importerPath = AssetDatabase.GetAssetPath(metallicGloss);
var importer = AssetImporter.GetAtPath(importerPath) as TextureImporter;
const string ConversionWarning = "The Metallic (R) Smoothness (A) texture needs to be converted to Roughness (B) Metallic (G). ";
if (importer && importer.swizzleG != TextureImporterSwizzle.OneMinusR) // can't really detect if this has been done on the texture already, this is just a heuristic...
{
if (EditorUtility.DisplayDialog("Texture Conversion",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public void SaveGLTFandBin(string path, string fileName)
_exportOptions.BeforeSceneExport?.Invoke(this, _root);
BeforeSceneExport?.Invoke(this, _root);
beforeSceneExportMarker.End();

_root.Scene = ExportScene(fileName, _rootTransforms);

if (ExportAnimations)
Expand Down

0 comments on commit 8dd9890

Please sign in to comment.