SetSharedObject.cs 764 B

1234567891011121314151617181920212223242526
  1. namespace BehaviorDesigner.Runtime.Tasks.Unity.SharedVariables
  2. {
  3. [TaskCategory("Unity/SharedVariable")]
  4. [TaskDescription("Sets the SharedObject variable to the specified object. Returns Success.")]
  5. public class SetSharedObject : Action
  6. {
  7. [Tooltip("The value to set the SharedObject to")]
  8. public SharedObject targetValue;
  9. [RequiredField]
  10. [Tooltip("The SharedTransform to set")]
  11. public SharedObject targetVariable;
  12. public override TaskStatus OnUpdate()
  13. {
  14. targetVariable.Value = targetValue.Value;
  15. return TaskStatus.Success;
  16. }
  17. public override void OnReset()
  18. {
  19. targetValue = null;
  20. targetVariable = null;
  21. }
  22. }
  23. }