summaryrefslogtreecommitdiff
path: root/Client/Assets/Behavior Designer/Runtime/Basic Tasks/LayerMask/SetLayer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Behavior Designer/Runtime/Basic Tasks/LayerMask/SetLayer.cs')
-rw-r--r--Client/Assets/Behavior Designer/Runtime/Basic Tasks/LayerMask/SetLayer.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Client/Assets/Behavior Designer/Runtime/Basic Tasks/LayerMask/SetLayer.cs b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/LayerMask/SetLayer.cs
new file mode 100644
index 00000000..09f218d6
--- /dev/null
+++ b/Client/Assets/Behavior Designer/Runtime/Basic Tasks/LayerMask/SetLayer.cs
@@ -0,0 +1,27 @@
+using UnityEngine;
+
+namespace BehaviorDesigner.Runtime.Tasks.Basic.UnityLayerMask
+{
+ [TaskCategory("Basic/LayerMask")]
+ [TaskDescription("Sets the layer of a GameObject.")]
+ public class SetLayer : Action
+ {
+ [Tooltip("The GameObject to set the layer of")]
+ public SharedGameObject targetGameObject;
+ [Tooltip("The name of the layer to set")]
+ public SharedString layerName = "Default";
+
+ public override TaskStatus OnUpdate()
+ {
+ var currentGameObject = GetDefaultGameObject(targetGameObject.Value);
+ currentGameObject.layer = LayerMask.NameToLayer(layerName.Value);
+ return TaskStatus.Success;
+ }
+
+ public override void OnReset()
+ {
+ targetGameObject = null;
+ layerName = "Default";
+ }
+ }
+} \ No newline at end of file