PlayerControls Combat action not registering in VSC

Running into a perplexing and frustrating issue; I’ve added the “Combat” action map to my PlayerControls, set up “Attack” as a button, assigned to left click [mouse]. I’ve saved the changes. When I go into the code for the sword, as far as I can tell I’ve copied it letter for letter, but when I go to type the “playerControls.Combat” line under start, it refuses to recognize the “Combat” action map, and my code is dead in the water. Maybe I missed something small in the code, but I can’t find it. Here it is:

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

public class Sword : MonoBehaviour
{
    private PlayerControls playerControls;

    private void Awake() 
    {
        playerControls = new PlayerControls();
    }

    private void OnEnable() 
    {
        playerControls.Enable();
        
    }
    // Start is called before the first frame update
    void Start()
    {
        
    }
}

And here’s my PlayerControls:

Visual Studio Code is a fickle mistress, and I often say it’s worth exactly what you pay for it…

Make sure you’re using the new Unity Extension within VSC Announcing the Unity extension for Visual Studio Code - Visual Studio Blog
Then make sure you’re using the latest version of the Visual Studio plugin from the Package Manager, and remove the Visual Studio Code plugin.

Privacy & Terms