Hey everyone and how is your day. So im pretty much new to this engine matter fact kinda new to programming in general. So i was somewhat following this tutorial on how to make a 2d platformer and i followed everything through but the game wont run now. The video a few years old but I’m running unity 5. I dont know how to fix this either. Its an error saying "Cannot explicitly convert type ’ UnityEngine.RigidBody2D[ ]’ to ’ UnityEngine.RigidBody2D’
Here is the code that I used in visual Studios. I really appreciate the help.
using UnityEngine;
using System.Collections;
public class Player : MonoBehaviour
{
public float speed = 50f;
public float jumpPower = 150f;
public bool grounded;
private Rigidbody2D rb2d;
void Start()
{
rb2d = gameObject.GetComponents<Rigidbody2D>();
}
void Update()
{
}
void FixedUpdate()
{
float h = Input.GetAxis("Horizontal");
rb2d.AddForce((Vector2.right * speed) * h);
}
}