- Home /
Problem accessing vector properties
Hello guys, I'm new to Unity 3D and currently im working on a iphone project using unity javascript. I encountered this compile error: BCE0019: 'x' is not a member of 'Object'.
my codes are somewhat like this:
#pragma strict
private static var pointsArray:Array ;
private static startGeneratePoints() { pointsArray = new Array(); var randomPoint:Vector3;
for(var i:int = 0; i < 3; i++)
{
randomPoint = new Vector3(i,1,1);
pointsArray.Push(randomPoints);
}
print(pointsArray[0].x);
}
then i tried:
var tempVector2:Vector3 = pointsArray[0];
trying to assign it into a vector3, this is the error i get:
BCE0022: Cannot convert 'Object' to 'UnityEngine.Vector3'.
Then, i try to cast it to vector3:
var tempVector2:Vector3 = pointsArray[0] as Vector3;
this is the error i get:
BCE0006: 'UnityEngine.Vector3' is a value type. The 'as' operator can only be used with reference types.
Anyone got an idea on how to solve this issue? How can I get the 'x' properties of the vector3 inside an array?
Downvoted for not taking any time to make that readable. Please put more effort into the use of the code tags.
Your answer
Follow this Question
Related Questions
Unity3D - Playback object array of position (with dynamic velocity) 0 Answers
Getting a 2d Sprite to move over time to an Array 1 Answer
Object moves to new location in vector array 1 Answer
No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(Object)' was found. 1 Answer
Object to Foo is okay, but Object[] to Foo[] gives error. 1 Answer