Input error for UFO tutorial

I’m at 14:44 in this UFO tutorial and I’m pretty sure I’ve done something wrong. Input.GetAxis is not reading my keyboard input and I don’t know how to tell Unity/CSharp that I would like to get input from the keyboard. I know we should not upload our games, but I don’t believe the problem is in the code. I believe the problem is in how my Unity editor is set up.

In the editor I’m getting the error “NullReferenceException: Object reference not set to an instance of an object PlayerController.FixedUpdate () (at Assets/Scripts/PlayerController.cs:19)”. I’m pretty sure that could have something to do with my error.

Can someone figure this out for me?

3229184–247785–Ufo game.rar (2.98 MB)

Next time, just post the script with the error using the insert code button so it’s formatted :slight_smile:

It’s a simple mistake, you need Start to be capitalized. C# is case sensitive, so void start() is different than void Start().

Because your Start method was named start, it wasn’t firing on the 1st frame, so it wasn’t getting the Rigidbody2D component, and that caused the error when you tried to use that referenced component, which was null.

Wow, I had start lowercase. I thank you for your patience!

That was really stupid of Brian. Once again, thanks for your patience.

Don’t worry, when I was starting out I did dumber things. But I certainly never turned off all console notifications, then wrote a script using Debug.Log, then posted it on the forum because it wasn’t showing in the console. No, I definitely never did that :wink: