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

Resolved Open Door Script help please

Discussion in 'Scripting' started by midnight622, Jul 20, 2023.

  1. midnight622

    midnight622

    Joined:
    Dec 20, 2021
    Posts:
    6
    I know it's a just to be something little, but I really can't figure this out right now. please help!
    Screenshot 2023-07-19 213136.png
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Ryiah and Bunny83 like this.
  3. midnight622

    midnight622

    Joined:
    Dec 20, 2021
    Posts:
    6
    Screenshot 2023-07-19 220159.png (17,61): error CS1061: 'GameObject' does not contain a definition for 'tranform' and no accessible extension method 'tranform' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)
     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    You're just making typos. Look at your spelling again.
     
  5. midnight622

    midnight622

    Joined:
    Dec 20, 2021
    Posts:
    6
    also forgot brackets after If.
     
  6. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,769
    Strictly speaking this:
    Code (CSharp):
    1. if (condition)
    2.     SomeMethod();
    Is valid C#, and the same as this:
    Code (CSharp):
    1. if (condition)
    2. {
    3.     SomeMethod();
    4. }
     
    Ryiah likes this.