Skip to content

Commit

Permalink
Added graphic option to layer applier & removed outdated comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Indigocoder1 committed Sep 14, 2024
1 parent 1c2a2d5 commit 3a31553
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Nautilus/Utility/ThunderkitUtilities/ApplySNLayer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Reflection;
using UnityEngine;
using UnityEngine.UI;

namespace Nautilus.Utility.ThunderkitUtilities;

Expand All @@ -9,7 +10,7 @@ internal class ApplySNLayer : MonoBehaviour
public LayerName layerName;

[Tooltip("How to apply the layer")]
public GeneralSetMode layerSetMode;
public MaterialSetMode layerSetMode;

private void Start()
{
Expand Down Expand Up @@ -37,20 +38,23 @@ private void Start()

switch(layerSetMode)
{
case GeneralSetMode.SingleObject:
case MaterialSetMode.SingleObject:
gameObject.layer = layer;
break;
case GeneralSetMode.AllChildObjects:
case MaterialSetMode.AllChildObjects:
GetComponentsInChildren<GameObject>().ForEach(g => g.layer = layer);
break;
case GeneralSetMode.AllChildObjectsIncludeInactive:
case MaterialSetMode.AllChildObjectsIncludeInactive:
GetComponentsInChildren<GameObject>(true).ForEach(g => g.layer = layer);
break;
case MaterialSetMode.AllChildGraphics:
GetComponentsInChildren<Graphic>(true).ForEach(g => g.gameObject.layer = layer);
break;
}
}

/// <summary>
/// These are taken from <see cref="LayerID"/>, and are retrieved using reflection
/// These are taken from <see cref="LayerID"/>
/// </summary>
public enum LayerName
{
Expand Down

0 comments on commit 3a31553

Please sign in to comment.