Search Unity

Cannot apply indeing with[] to an expression of type 'GameObject'

Discussion in 'Scripting' started by GrafSeeger, Jul 26, 2017.

  1. GrafSeeger

    GrafSeeger

    Joined:
    Jun 22, 2016
    Posts:
    19
    Hello Guys, I got this error while making this :

    //Wand is a GameObject[,] and a,b,x,y are ints
    // And I get the error at Wand[i,j]
    Code (CSharp):
    1. Raum.Add(new RaumClass(Wand[i,j], a, b, x, y));

    Thanks :)
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Are you positive that Wand is a 2D array of GameObjects? Can you show the line where Wand is declared?
     
  3. johne5

    johne5

    Joined:
    Dec 4, 2011
    Posts:
    1,133
    and show us the declaration of RaumClass(Wand[i,j], a, b, x, y))