0

I had a 2d array After instantiate, i set GameObject to my array and try to call it from array by index and use getComponent, it works fine. But in next time of for-loop, calling exist array's GameObject by index return null when i try getComponent Someone has idea or resolution ?! Thanks for your help !

enter image description here

enter image description here

Prajwal
  • 3,930
  • 5
  • 24
  • 50
  • It means (Block) Component doesn't exist in my GameObject ?! I tried to get other component such as Image, it still works fine. I haven't removed any Component before. Do you know why (Block) Component disappear ?! Thank you ! – kichiro09 Jun 20 '18 at 04:35
  • in the first one it is called on [i,j] in the second call, it is on [1,0].. is this intended? – Plexis Plexis Jun 20 '18 at 05:16

1 Answers1

0

enter image description here This problem appears because I created 2 array to same new GameObject[,] so when i set GameObject to fruits2,it also set same element of blocks array and made (Block) component disappear