- 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
28
Editor/Validators/GameObject/GameObjectValidatorTransform.cs
Normal file
28
Editor/Validators/GameObject/GameObjectValidatorTransform.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.ProjectValidator.Editor
|
||||
{
|
||||
internal sealed class GameObjectValidatorTransform : IGameObjectValidator
|
||||
{
|
||||
public void Validate(GameObject gameObject, List<ValidatorResult> results)
|
||||
{
|
||||
var transform = gameObject.transform;
|
||||
var lp = transform.localPosition;
|
||||
var lr = transform.localRotation;
|
||||
var ls = transform.localScale;
|
||||
|
||||
if (IsInvalid(lp.x) || IsInvalid(lp.y) || IsInvalid(lp.z))
|
||||
results.Add(ValidatorResult.Create(EValidatorSeverity.Error, $"Local position '{lp}' is invalid"));
|
||||
if (IsInvalid(lr.x) || IsInvalid(lr.y) || IsInvalid(lr.z) || IsInvalid(lr.w))
|
||||
results.Add(ValidatorResult.Create(EValidatorSeverity.Error, $"Local rotation '{lr}' is invalid"));
|
||||
if (IsInvalid(ls.x) || IsInvalid(ls.y) || IsInvalid(ls.z))
|
||||
results.Add(ValidatorResult.Create(EValidatorSeverity.Error, $"Local scale '{ls}' is invalid"));
|
||||
}
|
||||
|
||||
private static bool IsInvalid(float value)
|
||||
{
|
||||
return float.IsNaN(value) || float.IsInfinity(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue