0
votes

I've seen many people talking about VScode not showing error squiggles but thats not the issue I'm having... for me its not even detecting them in the error window in the terminal.

Screenshot of workspace with obvious errors yet no detection in the window. Screenshot of workspace with obvious errors yet no detection in the window.

as you can see in the photo I removed all the semicolons from my variables and it still detects nothing, I have it set to trusted window, ive tried all the fixes ive found but nothing is working.

Code:

using UnityEngine;

public class PlayerMovement : MonoBehaviour { [SerializeField] private float jumpHeight [SerializeField] private float speed private LayerMask groundLayer private Rigidbody2D body private Animator anim private BoxCollider2D boxCollider

    private void Awake()
    {
        //References to Rigidbody and animator components
        body = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
        boxCollider = GetComponent<BoxCollider2D>();
    }

    private void Update()
    {
        float horizontalInput = Input.GetAxis("Horizontal");
        body.velocity = new Vector2(horizontalInput * speed, body.velocity.y)];

        //Flip when moving Left-Right
        if(horizontalInput > 0.01f)
        {
            transform.localScale = Vector3.one;
        }
        else if (horizontalInput < -0.01)
        {
            transform.localScale = new Vector3(-1, 1, 1);
        }

        if(Input.GetKey(KeyCode.Space) && isGrounded)
        {
            Jump();
        }

        anim.SetBool("Run", horizontalInput != 0);
    }

    private void Jump()
    {
        body.velocity = new Vector2 (body.velocity.x, speed);
        anim.SetTrigger("jump");
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
    }


    private bool isGrounded()
    {
        RaycastHit2D raycastHit = Physics2D.BoxCast(boxCollider.bounds.center, boxCollider.bounds.size, 0, Vector2.down, 0.1f, groundLayer);
        return false;
    }
}
1
Make sure you have the C# extension installed from the Extensions page. After this you should be able to start OmniSharp which will detect errors in your C# code.Jeff Chen
Does this answer your question? VSCode + C# (OmiSharp) not showing any errorsjoreldraw

1 Answers

0
votes

@joreldraw thank you but i've already tried that. @Jeff Chen thank you for your help!! that finally fixed it! I had tried restarting Omnisharp about 100 times but i had never tried to start it.