- Home /
Question by
Wowmaniac · Jul 25, 2014 at 07:18 PM ·
instantiatetransformarray
MissingMethodException: System.Collections.Generic.List
I get this error when trying to add a transform to my generic list using javascript.
var Roads : List.< Transform > = new List.< Transform >(); function Update(){ if(currentRoad == null){ currentRoad=Instantiate(intersection,hit.point,Quaternion.identity); Roads.add(currentRoad.transform); } }
If I add a transform to the list in function Start(), it works properly.
Sorry I'm not sure How to add a nice code box.
Comment
Best Answer
Answer by Landern · Jul 25, 2014 at 07:21 PM
put an import statement for the namespace at the top of the script, add should have a capital "A":
import System.Collections.Generic;
var Roads : List.< Transform > = new List.< Transform >();
function Update(){
if(currentRoad == null){
currentRoad=Instantiate(intersection,hit.point,Quaternion.identity);
Roads.Add(currentRoad.transform);
}
}
I had the import in my code. The problem was the missing capital.
Thanks a lot. :)