- Home /
Question by
Trorlroprlro · Oct 18, 2014 at 04:57 PM ·
terrainpositioni
Position is not a member of object
Hello.
I have a problem with this:
for (i = 0; i < treeArray.length; i++)
{
var treePosition : Vector3 = Vector3.Scale(treeArray.position, terrain.size);
}
It just says
'position' is not a member of 'Object'.
I don't know what is wrong since im quite new in unity. I tried to search but it didnt give me any answers. Thanks for your time :)
Comment
Answer by 767_2 · Oct 18, 2014 at 05:03 PM
as i can see treeArray is an object and you are trying to access treeArray.position but it doesn't got position
Heres the whole script:
treeCount = Terrain.activeTerrain.terrainData.treeInstances;
treeArray = new Array(treeCount);
function Update()
{
for (i = 0; i < treeArray.length; i++)
{
var treePosition : Vector3 = Vector3.Scale(treeArray.position, terrain.size);
}
}