Search Unity

Tower Defense Game

Discussion in 'Scripting' started by tillian, Apr 2, 2016.

  1. tillian

    tillian

    Joined:
    Jan 5, 2016
    Posts:
    11
    I am working on a Tower Defense Game. Right now, i am writing the scripts. (Following youtube tutorial).
    I have no experience with scripting.

    Here is my problem.

    I have followed the tutorial, I had some error but managed to fix them on my own.
    I have several scripts that having an issue with.

    1. When i apply the PlayerMotor.cs to the player, it doesnt drop from plane to plane ( gravity)?
    Note: There is no errors in any of the Scripts.

    2. The PlayerMotor.cs and WalkingState.cs are grayed out. I was told from other posts, that if script is grayed out means that there is an error. Like i said there is no error showing up in the Console
    3. The only error that i get is after i hit play. which is....

    NullReferenceException: Object reference not set to an instance of an object
    BaseMotor.Grounded () (at Assets/Scripts/Motor/BaseMotor.cs:59)
    WalkingState.Transition () (at Assets/Scripts/Motor/State/WalkingState.cs:22)
    PlayerMotor.UpdateMotor () (at Assets/Scripts/Motor/PlayerMotor.cs:16)
    BaseMotor.Update () (at Assets/Scripts/Motor/BaseMotor.cs:37)

    I would Appropriate any assistance, with fixing these issue. Also remember that, i have no clue or understand script.
     

    Attached Files:

  2. tillian

    tillian

    Joined:
    Jan 5, 2016
    Posts:
    11
  3. RavenOfCode

    RavenOfCode

    Joined:
    Apr 5, 2015
    Posts:
    869
    I would suggest you try to learn how scripting in unity works, take a look at the Roll-a-ball tutorial in the learn section. If you dont understand how to do the basics then you will never be able to do something complicated.

    Also your errors just state that you didnt assign something in the inspector.