Add 2 Vectors C#

Good Afternoon, I am trying to add 2 vector3 arrays together and am getting the following error?

    using UnityEngine;
    using UnityEditor;
    using System.Collections;
    
    public class Testing : MonoBehaviour {
    
    private Vector3[] testing1;
    private Vector3[] testing2;
    private Vector3[] total;
    
    
    void Start(){
    
   total  =	testing1 + testing2;
    
    }
    }

error CS0019: Operator +' cannot be applied to operands of type UnityEngine.Vector3’ and `UnityEngine.Vector3

Yea + won’t work with arrays like that.

var z = new int[x.Length + y.Length];
x.CopyTo(z, 0);
y.CopyTo(z, x.Length);

Should do the trick, if you use Lists I think you can also use AddRange.

Thanks for all the help, Fully working now :slight_smile:

      using UnityEngine;
      using UnityEditor;
      using System.Collections;
      using System.Linq;
      
      public class Testing : MonoBehaviour {
      
      private Vector3[] testing1;
      private Vector3[] testing2;
      private Vector3[] total;
      
      
      void Start(){
      
      total = testing1.Concat(testing2).ToArray();
      
      }
      }