Skip to content

Commit

Permalink
add extension to set layers for whole hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyDuchess committed Aug 5, 2024
1 parent 71c4e36 commit 8b5a27f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Assets/Scripts/OpenTS2/GameObjectExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace OpenTS2
{
public static class GameObjectExtensions
{
public static void SetLayerHierarchy(this GameObject go, int layer)
{
var transforms = go.GetComponentsInChildren<Transform>();
foreach(var transform in transforms)
{
transform.gameObject.layer = layer;
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/OpenTS2/GameObjectExtensions.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8b5a27f

Please sign in to comment.