Search Unity

What is wrong with this

Discussion in 'Scripting' started by ThatOneCake, Sep 24, 2019.

  1. ThatOneCake

    ThatOneCake

    Joined:
    Dec 2, 2018
    Posts:
    36
    so i got my code

    if (Input.GetKeyDown("shift") = 1 )

    print("running");

    and unity says there is somthing wrong please help
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    For starters, GetKeyDown returns a bool. It's also a method and cannot be assigned a value.
     
  3. ThatOneCake

    ThatOneCake

    Joined:
    Dec 2, 2018
    Posts:
    36
    oh thx
     
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    And for the future, use code tags when posting. Also:
    Copy and paste the actual error message, this is useless. Luckily this one was easy to spot instantly, but that's often not the case.
     
    lordofduct likes this.
  5. ThatOneCake

    ThatOneCake

    Joined:
    Dec 2, 2018
    Posts:
    36
    will make sure to do that
     
  6. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,531
    Yeah, definitely come with the error message. Often times the error message says in it what exactly is wrong.
     
    Kurt-Dekker likes this.