`GameObject.AddComponent` is documented as adding a script to a GO. Your `MovementArray` is an array of `GameObject`s. You cannot add a GO as a component. I think you are suggesting that the GOs in the `MovementArray` all have different scripts applied. So, you'll need to use `GetComponents` to get a list of the components on the GO. So, something like (not compiled, might have bugs, but you get the idea):
GameObject movementGO = MovementArray[Random.Range(int 0, MovementArray.Length-1)];
A[] a = movementGO.GetComponents();
B[] b = movementGO.GetComponents();
C[] c = movementGO.GetComponents();
if (a.length > 0)
NewEnemy.AddComponent();
if (b.length > 0)
NewEnemy.AddComponent();
if (c.length > 0)
NewEnemy.AddComponent();
where your script components are called A, B and C. I suspect they have a more descriptive name (which will be the name of the class in your c# scripts.)
↧