riversong code showcase

This commit is contained in:
Daniele Marotta
2026-05-21 15:52:18 +02:00
commit 4c9eea1c02
462 changed files with 23406 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using UnityEngine;
using UnityEngine.Pool;
namespace DanieleMarotta.RiversongCodeShowcase
{
public static class GameObjectLayers
{
public static readonly int Default = LayerMask.NameToLayer("Default");
public static readonly int Terrain = LayerMask.NameToLayer("Terrain");
public static readonly int IgnoreAoE = LayerMask.NameToLayer("Ignore AoE");
public static void SetLayerRecursively<T>(this GameObject gameObject, int layer, bool includeInactive = false) where T : Component
{
using var componentsScope = ListPool<T>.Get(out var components);
gameObject.GetComponentsInChildren(includeInactive, components);
foreach (var component in components) component.gameObject.layer = layer;
}
}
}