0

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;
    }
}
David Buck
  • 3,752
  • 35
  • 31
  • 35
  • 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 Oct 21 '21 at 04:07
  • Does this answer your question? [VSCode + C# (OmiSharp) not showing any errors](https://stackoverflow.com/questions/43957366/vscode-c-sharp-omisharp-not-showing-any-errors) – joreldraw Oct 21 '21 at 06:07

2 Answers2

0

@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.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – David Buck Oct 29 '21 at 05:28
0

This started working for me after I installed the latest .NET SDK and then restarted my PC.