i need an urgent fix please help its for an assignment

pythex 0 Reputation points
2023-03-01T10:12:07.0666667+00:00
#if ENABLE_INPUT_SYSTEM
using UnityEngine
InputSystem;
#endif
using UnityEngine;
#if ENABLE_INPUT_SYSTEM
public class Character_move : MonoBehaviour
{
    CharacterController cha;
    Vector3 move_speed;
    float gravity=-9.8f;
    float jump_speed=0.5f;

    void Start()
    {
        cha=GetComponent<CharacterController>();
    }

    void Update()
    {
        move_speed=new Vector3(Input.GetAxis("Horizontal"),move_speed.y+gravity*Time.deltaTime,Input.GetAxis("Vertical"));
        if(Input.GetKeyDown(KeyCode.Space))
        {
            move_speed.y=jump_speed;
        }
        cha.Move(move_speed);     
    }
#endif
}
 #if ENABLE_INPUT_SYSTEM
}   
#endif

public class character : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

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

Community Center | Not monitored
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.