- Validator: Added asset validators with material texture and shader validation
- Validator: Added option to enable/disable certain validators - Project Settings: Fixed issue, where changes weren't always saved - Unity: Removed deprecated warnings in Unity 6.4
This commit is contained in:
parent
01ac17a078
commit
dd55a87740
30 changed files with 716 additions and 38 deletions
31
Editor/Validators/Assets/AssetValidatorMaterialTexture.cs
Normal file
31
Editor/Validators/Assets/AssetValidatorMaterialTexture.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Module.ProjectValidator.Editor
|
||||
{
|
||||
internal sealed class AssetValidatorMaterialTexture : IAssetValidator<Material>
|
||||
{
|
||||
public void Validate(Material obj, List<ValidatorResult> results)
|
||||
{
|
||||
if (obj.shader == null)
|
||||
return;
|
||||
|
||||
var count = obj.shader.GetPropertyCount();
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var propertyType = obj.shader.GetPropertyType(i);
|
||||
|
||||
if (propertyType != ShaderPropertyType.Texture)
|
||||
continue;
|
||||
|
||||
var propertyName = obj.shader.GetPropertyName(i);
|
||||
var propertyValue = obj.GetTexture(propertyName);
|
||||
|
||||
if (propertyValue == null)
|
||||
results.Add(ValidatorResult.Create(EValidatorSeverity.Warning, $"Texture property '{propertyName}' is Null"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue