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

Unexpected token error

Discussion in 'Scripting' started by Will-Metcher, Dec 16, 2014.

  1. Will-Metcher

    Will-Metcher

    Joined:
    Nov 15, 2014
    Posts:
    14
    When ever I try and run this code I get an error saying
    Assets/InstantiateInput.js(17,71): BCE0043: Unexpected token: false.

    This error occurs in this line of code

    public function SetParent(InputAppear: Transform, worldPositionStays: false) {
    }

    Which has been copy and pasted directly from the Unity documentation with the exception of the variables I have changed.
    Below is a link to the aforementioned documentation
    http://docs.unity3d.com/ScriptReference/Transform.SetParent.html

    Any ideas would be greatly appreciated
    Thanks
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    worldPositionStays: boolean

    you are defining the TYPE of worldPositionStays. its TYPE is boolean, false is not a TYPE
    in c# its called bool instead
     
  3. Will-Metcher

    Will-Metcher

    Joined:
    Nov 15, 2014
    Posts:
    14
    Thanks man!
    I would have never figured that out by my self.