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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Scripting help

Discussion in 'Scripting' started by fastrat, Sep 10, 2013.

  1. fastrat

    fastrat

    Joined:
    May 27, 2013
    Posts:
    2
    Hey guys i'm pretty new to unity and so far I have been editing my environment but i'm finally getting into scripting and i'm having a problem with this test script I looked at from a tutorial. Its probably really obvious to you guys but i have no clue why it wont work.
    Code (csharp):
    1.  
    2. var hello : boolean = false;
    3. function Update () {
    4.  
    5. if(hello == true) {
    6.  
    7. print("works");
    8.  
    9.     }
    10. if(Input.GetKeyDown(KeyCode.E)){
    11.  
    12. myBool = true;
    13.  
    14.     }
    15.  
    16.  
    17.  
    18. }
    19.  
    Also sorry if this post is in the wrong place or its poorly made I have never posted on this forum before.
     
    Last edited: Sep 10, 2013
  2. Digital

    Digital

    Joined:
    Feb 6, 2011
    Posts:
    182
    What does not work? What is "myBool"? Change line 11 to "hello = true".
     
  3. BlackMantis

    BlackMantis

    Joined:
    Feb 7, 2010
    Posts:
    1,475
    - lol

    Happens to the best of us - Welcome to the forum.
     
  4. fastrat

    fastrat

    Joined:
    May 27, 2013
    Posts:
    2
    I just realized how much of a moron I am for not seeing that thank you so much lol.
     
    Last edited: Sep 10, 2013