[JS] - GetComponents (No appropriate version)

So I’ve got multiple components attached to a gameobject called ‘Gun_Module’ and I’m going to make an array and search through the array and switch off specific ones.

private var Gun_Module : Component;
private var GunScripts : Component[];

GunScripts = GetComponents(Gun_Module);

The error is that it says:

"No appropriate version of 'UnityEngine.Component.GetComponents' for the argument list '(UnityEngine.Component)' was found."

Help would be greatly appreciated!

ok, i guess Gun_Module is your class right? than it can not be a name of a variable, rather try this:

  private var GunScripts : Gun_Module[];
  GunScripts = GetComponents(Gun_Module);