- Home /
Help converting JS to C#
The error: Static member 'UnityEngine.Vector3.right' cannot be accessed with an instance reference, qualify it with a type name instead
relTransformPosition = Vector3.Project(railPosition, railTransform.right);
relRailPosition = Vector3.Project(transform.position, railTransform.right);
distance = (relTransformPosition.x - relRailPosition.x);
// Here's the line where I'm getting an error
transform.position += relRailPosition.right * distance;
The line you get the error is under a static function?
Answer by Wuzseen · Sep 11, 2012 at 06:03 PM
I believe what you need to do is put:
Vector3.relRailPosition.right
As far as I know with C#, static members need to be associated with the class they're from. I'm not sure if that's Vector3 or if that's right in this instance at all, but it's worth a go.
Relevant stack overflow question: http://stackoverflow.com/questions/1100009/member-method-cannot-be-accessed-with-an-instance-reference
Answer by arcadia · Sep 11, 2012 at 07:12 PM
http://answers.unity3d.com/questions/12911/what-are-the-syntax-differences-in-c-and-javascrip.html Here you go!
Your answer

Follow this Question
Related Questions
The Unity move - converting application from C++ to C# 3 Answers
software that makes scripts for you 6 Answers
Help...convert C# to Js ??? 3 Answers
Exported SWF no longer loads 1 Answer
can someone help me to convert this from pc to mobile platform 0 Answers