Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Insert a semicolon at the end when I already have a semicolon

Discussion in 'Editor & General Support' started by ROSSCOGamesOfficial, Mar 15, 2015.

  1. ROSSCOGamesOfficial

    ROSSCOGamesOfficial

    Joined:
    Jun 4, 2014
    Posts:
    19
    #pragma strict
    var Brick: GameObject;
    var WedgeBrick: GameObject;
    var SphereBrick: GameObject;
    var CylinderBrick: GameObject;
    var PointLight: GameObject;
    var Spotlight: GameObject;
    var SunLight: GameObject;
    var Cam: Transform;
    var BrickClicked = false;
    var BLDCamera: Camera;

    function Update () {
    Ray ray = BLDCamera.ScreenPointToRay(new Vector3(Input.MousePosition));;
    }

    function OnGUI () {
    if (GUI.Button(Rect(200,0,100,100), "Brick")){
    BrickClicked = true;
    }
    }
     
  2. ROSSCOGamesOfficial

    ROSSCOGamesOfficial

    Joined:
    Jun 4, 2014
    Posts:
    19
    Yes, I intended to have two semicolons
     
  3. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Did you have a question?
     
  4. ROSSCOGamesOfficial

    ROSSCOGamesOfficial

    Joined:
    Jun 4, 2014
    Posts:
    19
    Yes, how do I get rid of this error?
     
  5. BFS-Kyle

    BFS-Kyle

    Joined:
    Jun 12, 2013
    Posts:
    882
    For future reference, you should probably post the full error - you are getting the error:

    On the line:

    Code (JavaScript):
    1. Ray ray = BLDCamera.ScreenPointToRay(new Vector3(Input.MousePosition));;
    It looks like you have copied some C# code and tried to use it in UnityScript. There are a few issues with it:

    1. You don't need two semi-colons. Take one away.
    2. You are declaring the variable as type "Ray", but in UnityScript you should declare it like you have with the other variables (as a var with the type declared after the variable name)
    3. Input.MousePosition doesn't exist, its a lower-case 'm' for mousePosition

    So replace that line with this:

    Code (JavaScript):
    1. var ray : Ray = BLDCamera.ScreenPointToRay(Input.mousePosition);
     
    Socrates likes this.