i cant add my script and i can't find any errors and im using visual studio. What should i do

here is my code:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MovimentodePERSONAGEM : MonoBehaviour {

private Rigidbody2D body;

public float runSpeed = 10;

// Use this for initialization
void Start () {


// Update is called once per frame
void Update () {


private void GetFowardInput()
    body.velocity = new Vector2 (Input.GetAxis("Horizontal") * runSpeed, body.velocity.y);


Is the filename of the script the same as the class name?

If not, then make the filename the same as the class name.

You are not assigning the return value of GetComponent to your body variable. Do body = GetComponent…

Is there an error in Unity or can’t you just drag the script on the object?

If you script is really as short as you shown… debug it self

first create a new script / monobehavior (unity standard script when create a new)…
try attach it. (working?)
add rigidbody and runspeed in the code… try attach it. (see if problem also appears?)
add function “AddForwardInput” and try attach it. ect.
so you can maybe find the codeline which leads to the problem. :stuck_out_tongue: