This commit is contained in:
2026-07-09 21:33:33 +02:00
commit 84a2a365f3
2364 changed files with 950134 additions and 0 deletions
@@ -0,0 +1,32 @@
using System.Linq;
using Sirenix.OdinInspector.Editor.Validation;
using UnityEngine;
using VOID.Editor.AttributeValidator;
using VOID.Generic;
using VOID.Generic.Triggers;
[assembly: RegisterValidator(typeof(HideCeilingTriggerValidator))]
namespace VOID.Editor.AttributeValidator
{
public class HideCeilingTriggerValidator : ValueValidator<HideCeilingTrigger>
{
protected override void Validate(ValidationResult result)
{
if (Value == null) return;
ValidateHideableLayer(result);
}
private void ValidateHideableLayer(ValidationResult result)
{
var isWrongLayer = Value.gameObjectsToHide.SelectMany(go => go.GetComponentsInChildren<Transform>())
.Select(transform => transform.gameObject.layer)
.Any(layer => layer != LayerManager.StaticHideableIndex);
if (!isWrongLayer) return;
result.AddError($"All hideable objects targeted by this components needs layer <u>{nameof(LayerManager.StaticHideable)}</u>");
}
}
}