I'm a beginner making 2D games in Unity. I want the player to jump and move to create a stable character conga like Mario. I would like to borrow the code from the site of https://www.kitajima-ryoto.com/how-to-jump-like-mario/ and implement it, but when I build it with Visual Studio, errors occur frequently. There are two other scripts, but they are all stuck with similar errors. Please tell me the solution to realize the code. Please m (_ _) m

Error CS1061:'object' does not contain a definition for'y' and no accessible extension method'y' was found that accepts the first argument of type'object'. Make sure there are no missing using directives or assembly references.

Error CS0117:'PlayerController' does not have a definition of'JumpState'(CS0117)

The field'PlayerController.rb' is not assigned. Always use the default value null. (CS0649)

Corresponding source code

`` `C #
Source code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController: MonoBehaviour
[SerializeField] private Rigidbody2D rb;
private Vector2 localScale;
private bool isGrounded = true;
private bool isJumping = false;
private bool isJumpingCheck = true;
private float jumpTimeCounter;
private float jumpTime = 0.35f;
private float _jumpPower;
[SerializeField] private LayerMask platformLayer;

InputManager inputManager;
PlayerManager playerManager;
internal object velocity;

void Awake ()
localScale = transform.localScale;
jumpTimeCounter = jumpTime;

void Start ()
playerManager = PlayerManager.Instance;
inputManager = InputManager.Instance;

void Update ()
isGrounded = Physics2D.Linecast (transform.position --transform.up * 0.4f, transform.position --transform.up * 0.6f, platformLayer);

void FixedUpdate ()
if (inputManager.MoveKey! = 0)
// turn around
localScale.x = inputManager.MoveKey;
transform.localScale = localScale;

if (isGrounded)
rb.velocity = new Vector2 (inputManager.MoveKey * playerManager.MoveSpeed, rb.velocity.y);

if (isJumpingCheck&&inputManager.JumpKey! = 0)
jumpTimeCounter = jumpTime;
isJumpingCheck = false;
isJumping = true;
_jumpPower = playerManager.JumpPower;
else else
if (inputManager.JumpKey == 0)
isJumping = false;
if (! isJumping)
rb.velocity = new Vector2 (inputManager.MoveKey * playerManager.JumpMoveSpeed, Physics.gravity.y * playerManager.GravityRate);

if (isJumping)
jumpTimeCounter-= Time.deltaTime;

if (inputManager.JumpKey == 2)
_jumpPower-= 0.2f;
rb.velocity = new Vector2 (inputManager.MoveKey * playerManager.JumpMoveSpeed, 1 * _jumpPower);
if (jumpTimeCounter<0)

What I tried

When I attach this code to the player with unity, "The script cannot be added. The script component'PlayerController' cannot be added because the script class cannot be found. There is no compilation error, and the file name and class name match. Please check. "Is displayed.

Supplementary information (FW/tool version, etc.)

Version i am using
unity 2019 4.10f1
visual studio 8.7.7

  • Answer # 1

    The error disappeared when I erased other unused assets (...)