GameObject[]' does not contain a definition for 'GetComponent

‘GameObject’ does not contain a definition for ‘GetComponent’ and no accessible extension method ‘GetComponent’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)CS1061

1 Like

Please provide your code.

Here you can find info about using this method:

Use GameObject not GameObject
If you want to access the whole array of game object
you can access it one by one using loop
i.e GameObject a;
a[0].GetComponent<>

2 Likes