- Home /
Errors in Vector2 variables
For reasons unknown to me, I am getting these errors in my script :
- expecting ), found ','
- ';' expected. Insert a semicolon at the end
- expecting EOF, found '1' or expecting EOF, found '8'
I found these on both lines declaring Vector2 variables, and in setting them, according to these errors, it seems that it won't take two numbers to set a Vector2 variable. Why is this happening? For context purposes, here is my entire script:
var camera1 : Camera; var camera2 : Camera; var camera3 : Camera; var openButton : Texture2D; var closeButton : Texture2D; var mapMarker : Texture2D; var compass : Texture2D; var mapSkin : GUISkin; var characterTransform : Transform; var screenPos : Vector3; var playerDirection : Vector2 = (0, 1); //this line is one problem var deltaRotation : float = 0; var pivotPoint : Vector2 = (0.898, 8); //this line is the other problem
function Update () { if (camera2.enabled) { screenPos = camera.WorldToScreenPoint (characterTransform.position); } }
function OnGUI() { GUI.skin = mapSkin; if (camera1.enabled) { deltaRotation = Vector2.Angle(playerDirection,Vector2(characterTransform.forward.x, characterTransform.forward.z));
GUIUtility.RotateAroundPivot(deltaRotation,pivotPoint);
playerDirection = Vector2(characterTransform.forward.x, characterTransform.forward.z);
GUI.DrawTexture(Rect(1145,3,290,290),compass); if (GUI.Button(new Rect(1115,270,50,50),openButton)) { camera1.enabled = false; camera2.enabled = true; camera3.enabled = false; } } if (camera2.enabled) { GUI.DrawTexture(Rect(screenPos.x - 12,730 - screenPos.y,20,20),mapMarker); if (GUI.Button(new Rect(1250,100,100,100),closeButton)) { camera1.enabled = true; camera2.enabled = false; camera3.enabled = true; } } }
function Start () { camera2.enabled = false; }
Answer by Eric5h5 · Jan 21, 2011 at 05:08 AM
That's not how you define Vector2s.
var playerDirection = Vector2(0, 1);
thank you so much, I had asked another question, and in someone's response, the person had defined them like that, so I assumed it was correct.
Your answer
Follow this Question
Related Questions
Error BCE0044 plz help 0 Answers
EOF what does it mean? 3 Answers
BCE0044: expecting EOF, found }` error In my scripy 2 Answers
Please help, syntax error woe 2 Answers
Gun recoil/hitback animation problem 1 Answer