mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-12 21:45:06 -05:00
Merge pull request #557 from ousttrue/fix/renderer_materials_null
fix null in Renderer.sharedMaterials
This commit is contained in:
commit
a2ffc3cffc
|
|
@ -328,9 +328,23 @@ namespace VRM
|
|||
}
|
||||
|
||||
var renderers = ExportRoot.GetComponentsInChildren<Renderer>();
|
||||
var materials = renderers.SelectMany(x => x.sharedMaterials).Distinct();
|
||||
foreach (var r in renderers)
|
||||
{
|
||||
for(int i=0; i<r.sharedMaterials.Length; ++i)
|
||||
if (r.sharedMaterials[i] == null)
|
||||
{
|
||||
yield return Validation.Error($"Renderer: {r.name}.Materials[{i}] is null. please fix it");
|
||||
}
|
||||
}
|
||||
|
||||
var materials = renderers.SelectMany(x => x.sharedMaterials).Where(x => x != null).Distinct();
|
||||
foreach (var material in materials)
|
||||
{
|
||||
if (material == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (material.shader.name == "Standard")
|
||||
{
|
||||
// standard
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user