- Home /
Why am I getting this BCE0019 error? ScreenToWorldPoint' is not a member of 'System.Type
So, I'm very new to unity, and I'm trying to code a 2d game.
Below is the code I'm using right now, along with the error I'm getting.
var mainCam = Camera;
var topWall : BoxCollider2D;
var bottomWall: BoxCollider2D;
var Player01 : Transform;
function Update () {
topWall.size = new Vector2 (mainCam.ScreenToWorldPoint (new Vector3 (Screen.Width * 2f, 0f, 0f)).x, 1f);
topWall.center = new Vector2 (0f, mainCam.ScreenToWorldPoint (new Vector3 (0f, Screen.height, 0f)).y + 0.5f);
}
Assets/GameSetup.js(14,45): BCE0019: 'ScreenToWorldPoint' is not a member of 'System.Type'.
^ that is the error I'm getting.
I'm just going through a tutorial on youtube right now, and have triple checked that I have everything typed as he does. Any idea why I am getting this?
Answer by robertbu · Mar 09, 2014 at 10:14 PM
On line 1, I believe you want:
var mainCam : Camera;
That assumes you are initializing mainCam by drag and drop in the inspector.
Your answer
Follow this Question
Related Questions
[JavaScript Error] BCE0043: Unexpected token: 2 Answers
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Code Error, help please? 2 Answers