Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

I am getting this error in the unity console

"Assets\PlayerMovement.cs(13,10): error CS1519: Invalid token '=' in class, struct, or interface member declaration"

My Code

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

public class PlayerMovement : MonoBehaviour
{
    public CharacterController2D controller;

    public float horizontalMove = 0f;

    float runSpeed = 40f;

    bool = false; 

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

        horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;

        if (Input.GetButtonDown("jump"))
        {
            jump = true;
        }
    }
    void FixedUpdate()
    {
        controller.Move(horizontalMove * Time.fixedDeltaTime, false, jump);
        jump = false;
    }

}

you didn't name the boolean!

It just says bool = false

yes i noticed when i posted it lol, it mainly wasn't working tho because i didnt capitalize the j in "jump" lmao