Problem with Unity Script (c# Visual Studio)

I am new to unity and i was following a guide on the physics of a sprite however i got the error code:cs1513.
This is the script:

Any help?

Can you paste in the whole error?

1 Like

6455948--723572--upload_2020-10-25_22-13-21.png
I got this message

6455948--723572--upload_2020-10-25_22-13-21.png

Add an extra } to the end of your script. You never closed out your NewBehaviourScript Class.

Ok I will try

please can you show me where because there is a yellow line on the side indicating a problem

void Start()
{
    rb2d = GetComponent<Rigidbody2D>();
} //<<<Add this guy

Make sure your code is being posted as code and not an image. It will help others in the future.

ok thanks it worked but now there is another problem with the code error CS0246:

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour {
private rigidbody2D rb2d;

void Start()
{
rb2d = GetComponent();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis(“Horizontal”);
float moveVertical = Input.GetAxis(“Vertical”);
BitVector32 movement = new BitVector32(moveHorizontal, moveVertical);
rb2d.AddForce(movement);
}
}

i think it is because the tutorial is a mac user and i might have followed the mac code


the error

Change private rigidbody2D rb2d to private Rigidbody2D rb2d

The code you write will be the same on any platform.