Search Unity

Help!

Discussion in 'Getting Started' started by m200789, Dec 18, 2022.

  1. m200789

    m200789

    Joined:
    Dec 18, 2022
    Posts:
    1
    I was trying to make my first unity 2D game and is not working well, i get this error message
    what should i do?



    using System.ComponentModel.DataAnnotations.Schema;
    using System.Numerics;
    using UnityEngine;

    public class PlayerMovement : MonoBehaviour
    {
    private RigidBody2D body;

    private void Awake()
    {
    body = GetComponent<RigidBody2D>();
    }

    private body void Update()
    {
    body.velocity = new Vector2(Input.GetAxis("Horizontal"), body.velocity.y);
    }
    }[/code]
     
  2. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    1: Use CODE tags when displaying code.
    2: C# code is VERY case sensitive and also watch your spelling, it doesn't like misspelt words at all.


     
    m200789 likes this.
  3. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    1. Read it.
    2. Understand the error that is most often marked in the code.
    3. Correct a mistake.
    The learning element is understanding the errors you get from the debugger.