- Home /
Expression denotes C#
Hi, as the title/subject stated I get an error message that reads:
(91,49) Expression denotes a 'type', where a 'variable', 'value' or 'method group' was expected
I've converted the script-snippet from JS to C# and can not seem to figure out how to solve this issue.
The code follows like this in JS:
var pivot : Vector2 = Vector2(Screen.width/2, Screen.height/2);
GUIUtility.RotateAroundPivot(rotAngle%360,pivot);
GUI.DrawTexture(Rect ((Screen.width - size)/2 , (Screen.height - size)/2, size, size), myTexture);
And I converted it to C#: (NOTE: Only the first line has been changed)
Vector2 pivot = Vector2(Screen.width/2, Screen.height/2); //Error on this line, middle.
GUIUtility.RotateAroundPivot(rotAngle%360,pivot);
GUI.DrawTexture( new Rect((Screen.width - size)/2 , (Screen.height - size)/2, size, size), myTexture);
I have been staring at this issue for a while and I need, at least, a fresh pair of eyes.
Thanks in advance!
Answer by Spinnernicholas · Jan 02, 2014 at 06:37 PM
Change it to this, added "new":
Vector2 pivot = new Vector2(Screen.width/2, Screen.height/2);
Right... When using C# you need to use the new keyword in front of all constructors. Thanks for the help!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to retrieve GameObject's Vector2 coordinate and move another object to it's place 1 Answer
UnityEngine.Input.GetMouseButton(1)) issue 1 Answer
JS to C# conversion Problem 1 Answer
I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer