2
votes

When I edit the C# Unity Scripts, they open in Visual Studio. I've noticed that the autocomplete works on some lines but it doesn't in others.

Here you can see what's going on:

Moving image showing the issue

As you can see I get the autocomplete for GetComponent function only when I type inside the line 19.

I also tried this:

Additional picture that describes the issue

By moving the whole Start() function, autocomplete seems to work, but when moving back to the original place, it seems to stop working again.

By further testing, I noticed that autocomplete does not work on lines 11 through 14 and works on any other line.

I tried updating Visual Studio, deleting and recreating the C# Script, regenerated the project files and even reimporting all assets. Nothing worked.

Unity Version: 2020.2.7f1 Visual studio: 8.9.2 OS: macOS 11.2.3

1
hover on the red underlined line says something?rustyBucketBay
Unfortunately the file shown in this example has been modified as I had to move on with my project. It seems the issue has disappeared and kinda "fixed itself". However, I do remember what the red underlined text said. It was the typical, "the name [name] does not exist" and it would suggest me to generate code, either a class, a field or a function.Apostolos Pezodromou Apope

1 Answers

1
votes

Hm, that's strange. Try to go into the unity editor, go to edit/preferences/external Tools and select the VisualStudio version you are using as the external script-editor.