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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

identifier expected

Discussion in 'Scripting' started by Li0nX, Jul 20, 2020.

  1. Li0nX

    Li0nX

    Joined:
    Jun 25, 2020
    Posts:
    2
    I'm Making Crouch Script (Inside of fpscontroller script)
    It's Giving This Error;
    Assets\SC_FPSController.cs(73,23): error CS1001: Identifier expected
    The Code At 73. Line;
    Code (CSharp):
    1. if(Input.GetKeyDown.(KeyCode.LeftControl)){
    2. GameObject.FindGameObjectsWithTag("Player").transform.localscale = new Vector3(1f, 0.25f, 1f);
    3. }else{
    4. GameObject.FindGameObjectsWithTag("Player").transform.localscale = new Vector3(1f, 1f, 1f);
    5. }
    What's Wrong?
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,506
    Line 1, change to
    if(Input.GetKeyDown(KeyCode.LeftControl)){
     
    Li0nX likes this.
  3. Li0nX

    Li0nX

    Joined:
    Jun 25, 2020
    Posts:
    2
    Okay Guys I Found The Error Also I Solved The Component Error So The Last Code Is This;
    Code (CSharp):
    1.  
    2.         Transform transform;
    3.         if(Input.GetKeyDown(KeyCode.LeftControl)){
    4.             GameObject.FindGameObjectsWithTag("Player").transform.localscale = new Vector3(1f, 0.25f, 1f);
    5.         }else{
    6.             GameObject.FindGameObjectsWithTag("Player").transform.localscale = new Vector3(1f, 1f, 1f);
    7.         }
    8.