Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug PLEASE HELP

Discussion in 'Scripting' started by unity_CA0813935D41808973C8, Dec 1, 2022.

  1. unity_CA0813935D41808973C8

    unity_CA0813935D41808973C8

    Joined:
    Dec 1, 2022
    Posts:
    3
    please, can someone help me?
    i got error CS0111 and i dont know how to fix it

    Assets\scripts\movement.cs(19,10): error CS0111: Type 'movement' already defines a member called 'Update' with the same parameter types
    my code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class moveme{
    Rigidbody rb;
    [SerializeField] float movementSpeed = 6f;
    [SerializeField] float jumpForce = 5f;
    [SerializeField] Transform groundCheck;
    [SerializeField] LayerMask ground;


    // Start is called before the first frame update
    void Start()
    {
    rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
    float horizontalInput = Input.GetAxis("Horizontal");
    float verticalInput = Input.GetAxis("Vertical");

    rb.velocity = new Vector3(horizontalInput * movementSpeed, rb. velocity.y, verticalInput * movementSpeed);

    if (Input.GetButtonDown("Jump"))
    {
    rb.velocity = new Vector3(rb.velocity.x, jumpForce, rb.velocity.z);
    }
    }
    /*
    bool IsGrounded()
    {
    Physics.CheckSphere(groundCheck.position, .1f, )
    }
    */nt : MonoBehaviour

    }
     
  2. unity_CA0813935D41808973C8

    unity_CA0813935D41808973C8

    Joined:
    Dec 1, 2022
    Posts:
    3
    i updated the code
     

    Attached Files:

  3. unity_CA0813935D41808973C8

    unity_CA0813935D41808973C8

    Joined:
    Dec 1, 2022
    Posts:
    3
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,623