BuildString.cs 744 B

12345678910111213141516171819202122232425262728
  1. namespace BehaviorDesigner.Runtime.Tasks.Unity.UnityString
  2. {
  3. [TaskCategory("Unity/String")]
  4. [TaskDescription("Creates a string from multiple other strings.")]
  5. public class BuildString : Action
  6. {
  7. [Tooltip("The array of strings")]
  8. public SharedString[] source;
  9. [Tooltip("The stored result")]
  10. [RequiredField]
  11. public SharedString storeResult;
  12. public override TaskStatus OnUpdate()
  13. {
  14. for (int i = 0; i < source.Length; ++i) {
  15. storeResult.Value += source[i];
  16. }
  17. return TaskStatus.Success;
  18. }
  19. public override void OnReset()
  20. {
  21. source = null;
  22. storeResult = null;
  23. }
  24. }
  25. }