- Home /
Question by
neerajvsryback · Jul 17, 2018 at 12:47 PM ·
indexing-array
find index of an element of a materials array
the idea is this: there are enemies of different colour , a arrow of a random colour is spawned and it can be used to attack the same colour array. Now when the enemy of a particular colour is destroyed , no more knifes of that colour must be spawned.I am trying to remove the material of the weapon materialList i want to access the index no of the current gameObject material from an array called materials which is in the boardScript
this is my code.
knifeScript.listofNumbers.Remove (Array.FindIndex (boardScript.materials,gameObject.GetComponent ().sharedMaterial));
Comment
and what's the problem? I can see that you're trying to remove a material from listofNumbers. is that even filed with materials?