i wanted to add crouching in my game but i got the error CS1503 anyone knows how to fix it ?

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

public class Crouch : MonoBehaviour
{
CapsuleCollider playerCol;
float originalHeight;
public float reducedHeight;

// Start is called before the first frame update
void Start()
{
playerCol=GetComponent();
originalHeight = playerCol.height;
}

// Update is called once per frame
void Update()
{
if(Input.GetButtonDown(KeyCode.LeftControl))
Crouch2();
else if(Input.GetButtonUp(KeyCode.LeftControl))
GoUp();

}

void Crouch2()
{
playerCol.height=reducedHeight;
}

void GoUp()
{
playerCol.height=originalHeight;
}

}

Nobody memorized error messages by code. Please post the full error message. When posting code examples, please use code tags. Those add syntax highlighting and line numbers and make helping you a lot easier :slight_smile:

2 Likes