- Home /
'position' is not a member of 'object'
Hi I'm creating a game and I don't know how to fix this error:
BCE0019: 'position' is not a member of 'Object'.
transform.InverseTransformPoint(Vector3(path1[currentPathObj].position.x,transform.position.y,path1[currentPathObj].position.z));
Please help me! :)
Presumably you are using the Array class. Never do that; it's slow and untyped. Use built-in arrays or generic Lists ins$$anonymous$$d.
I'm 14 years old, I only work with the videos that I see on YouTube.
Please show the code where you declare and initialise path1 - the way your code is currently written, it needs to be an array of transforms.
Answer by robertbu · Jun 29, 2014 at 01:42 AM
'position' is a member of a transform, not a member of a Vector3. Assuming that path1 is an array of Vector3s, then just remove 'position'.
transform.InverseTransformPoint(Vector3(path1[currentPathObj].x,transform.position.y,path1[currentPathObj].position.z));
Note your code would also work if path1 is an array of Transforms.
I tried that, but it say's that x is not a member of object
We need to see more of your code to understand what is the right solution. $$anonymous$$y guess is that you used the Array class to store your data. That class is slow, untyped and is not recommended. If that is the problem, use either the built-in array class or the .NET List class.
Answer by Bolbo13 · Jun 29, 2014 at 02:06 AM
If paths are game objects you need to access transform first :
path1[currentPathObj].transform.position.x
I tried, but it say's that: 'transform' is not a member of 'Object'
Your answer
Follow this Question
Related Questions
Exception error 1 Answer
Is not a Member of Collisions 2 Answers
My Javascript is not opening 0 Answers
The name 'Message' does not denote a valid type ('not found'). 1 Answer
Raycast error 1 Answer