This is my first Game Jam Ever! Does anyone have any pointers? Also good luck everyone! :)
thoted49
7
Posts
2
Topics
A member registered Feb 08, 2021
Creator of
Recent community posts
Brackeys Game Jam 2021.1 community · Posted in If anyone needs some music loops for their game I'm down to take requests
New
Hi! I am New to Unity and the I have a problem with my script
Here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public float speed;
public float jumpForce;
public float moveInput;
private Rigidbody2D rb;
void start(){
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate(){
moveInput = Input.GetAxis("Horizontal");
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
}
}
And here is the error message:
NullReferenceException: Object reference not set to an instance of an object
PlayerController.FixedUpdate () (at Assets/PlayerController.cs:20)
New
Hi! I am New to Unity and the I have a problem with my script
Here is the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public float speed;
public float jumpForce;
public float moveInput;
private Rigidbody2D rb;
void start(){
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate(){
moveInput = Input.GetAxis("Horizontal");
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
}
}
And here is the error message:
NullReferenceException: Object reference not set to an instance of an object
PlayerController.FixedUpdate () (at Assets/PlayerController.cs:20