Search Unity

Please Help with Ground Check, Complete Newbie

Discussion in 'Getting Started' started by animatedathlete, Jan 16, 2020.

  1. animatedathlete

    animatedathlete

    Joined:
    Jan 16, 2020
    Posts:
    4
    hello everyone
    I am very new to Unity and I am trying to get started and make a simple platform game however I am stuck. I don't know if it's my scripting or something else I am doing wrong. I am following this tutorial on youtube cause I wanted to get stuck in quickly and fail quickly I am at 7;47 and I have a problem should now see that you have more options available in inspector such as the groundcheck, groundcheckradius etc.
    I
    myproblemwhat itis.JPG My Actual result mygoal.JPG My goal. myscript1.PNG myscript2.JPG
    Above is my script. Here is the tutorial I am following.
    https://www.androidauthority.com/can-build-basic-android-game-just-7-minutes-unity-813947/

    Thanks for your time for reading.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You're not showing the Console tab. Probably you're not even looking at it. You should arrange your tabs so that the Console is always visible; it's really important. Probably you have some error there, and that's preventing your script from compiling, which is why it's not showing its public properties in the Inspector.
     
    Bill_Martini likes this.
  3. animatedathlete

    animatedathlete

    Joined:
    Jan 16, 2020
    Posts:
    4
    console.JPG

    Thank you @JoeStrout I have uploaded the problem still having issues trying to fix it any pointers?
     
    Bill_Martini likes this.
  4. bob_mosh

    bob_mosh

    Joined:
    May 30, 2018
    Posts:
    12
    Looks like in your code you forgot an '}' as well as a semicolon. And probably you placed a && where it doesn't belong. Maybe check our code again and make sure you fix those things. After that, it should work again. :)

    I quickly found that where you check for the input of the GetMouseButtonDown in the "if" statement of your update, you are closing two braces, where you opened only one. So that is definitely one of the issues. :) Keep a lookout for those things. It's absolutely crucial that you code precisely, otherwise your code won't run or contain bugs.
     
  5. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    The reason @JoeStrout was asking to see the console is that it tells you all you need to know. Each error gets an error message stating the offending script name and line number. Because one error can confuse the compiler, you may get additional false errors.

    So, the console tells us that there is a problem with your PlayerControl script and it is on line 28. You have placed a close parentheses where it doesn't belong. This should be correct and correct the other two errors.

    Code (CSharp):
    1. if (Input.GetMouseButtonDown(0) && onGround) {
    When posting code, please use code tags.
     
    Last edited: Jan 17, 2020
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    It looks like you're opening the individual script files in VS instead of the project. I'm guessing that is why it is not highlighting in red your code errors as soon as you type them. Otherwise, this kind of error should be immediately noticeable as soon as they are written.
     
  7. animatedathlete

    animatedathlete

    Joined:
    Jan 16, 2020
    Posts:
    4
    Thanks, I have already fixed it thank you all for your time and input.
     
    Bill_Martini likes this.