Assets\Playercontroller.cs(22,5): error CS8803: Top-level statements must precede namespace and type declarations.

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

public class Playercontroller : MonoBehaviour;
Debug.Log()
    // Start is called before the first frame update
    void Start() 
    
    {public float speed = 150;  
    float moveHorizontal = Input.GetAxis(“Horizontal”);
    float moveVertical = Input.GetAxis(“Vertical”);
    Vector3 movement = new Vector3(moveHorizontal,0.0f,moveVertical);
    

    }
    

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

In future, format your code correctly by surrounding it with 3 backticks (I have edited it for you).

Though, your code is completely incorrect. You should go through some basic programming tutorials on Unity Learn and make sure your IDE is configured, giving you error highlighting and autocomplete.

The code’s got random statements scattered/pasted through it, it’s poorly indented, it doesn’t even terminate properly. It’s an unworkable mess that needs to be recreated when your IDE is functioning so you can’t get it to this state.

1 Like