Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
// Materials (.mat) post processing:

var material = (Material)AssetDatabase.LoadAssetAtPath(asset, typeof(Material));
if (material == null)
continue;
Comment on lines +337 to +338
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should threat this an exception or log error. It feels risky we silently fail to process a material.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, I'm not sure. As I don't have a repro case, I'm working under the impression that these are not really materials, but some other assets that happen to have a .mat extension. But I'm not sure if that's even allowed or makes sense in any valid use case. Does unity have strict 1:1 mapping between asset file extensions and asset types? Perhaps this needs some deeper investigation...


if (MaterialReimporter.s_ReimportShaderGraphDependencyOnMaterialUpdate && GraphUtil.IsShaderGraphAsset(material.shader))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
// this skips any materials that only target other render pipelines, are user shaders,
// or are shaders we don't care to version
var material = (Material)AssetDatabase.LoadAssetAtPath(asset, typeof(Material));
if (material == null)
continue;

var shaderID = GetShaderID(material.shader);
if (shaderID == ShaderID.Unknown)
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
// This skips any materials that only target other render pipelines, are user shaders,
// or are shaders we don't care to version
var material = (Material)AssetDatabase.LoadAssetAtPath(asset, typeof(Material));
if (material == null)
continue;

var shaderID = GetShaderID(material.shader);
if (shaderID == ShaderID.Unknown)
continue;
Expand Down