Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Using arrays and for loop with GetComponent error

$
0
0
{ var Enemy : int[]; var dusman : int[,]; var Probab : int[]; for (var i = 1; i< 6 ; i++) { for (var j = 1; j< 6 ; j++) { dusman[i,j] = Enemy[i].GetComponent(EnemyScript).Probab[j]; } } This is the code I use for defining spawn probabilities for enemies. I got 5 prefabs of enemy and all have "Probab1","Probab2" ... to 5. I want to assign those numbers to **"dusman"** so for example it will be like dusman12 1 means first prefab and 2 means Probab2. I use 5 different probability variables for 5 different time/level. But I got this error when I try to compile : **'GetComponent' is not a member of 'Object'** I also assigned 5 prefab as collider to player object which includes these codes. Which defined as Enemy1,Enemy2,Enemy3. Can anaybody help me where is the problem ? Thank You..

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>