Here’s my code:
public class Door : Interactable
{
[SerializeField]
private GameObject
//this function is where we will design our interation using code
protected override void Interact() {
Debug.Log("Interacted with " + gameObject.name);
}
}
Here is the error:
Assets\Scripts\Interactables\Door.cs(11,5): error CS1585: Member modifier 'protected' must precede the member type and name
So basically, the error code is on the line if protected override void Interact() {
Previously, it was on the void public() {
line, then i deleted that, so it moved to the void update() {
line, which I then proceeded to delete as well. It’s very peculiar because if I delete the protected
, then the error would move to the override
, then to the void
, but never at the same time; it would only show an error to the latest word.
I have found other threads with similar errors (pretty much exact same Error CS1519
) but different lines of code, each with different fixes. I can’t seem to figure out what’s wrong with mine? I tried reinstalling Visual Studio 2022, and so I’m currently in Safe Mode trying to fix this error. I just followed instructions from a YouTube tutorial on interactables, and this appeared out of nowhere as I was fixing some UI stuff.