Here’s what’s going on when I typed in a function:
The moment I type in the left parenthesis ‘(’, the VS Editor will automatically fill them up, while also adding an extra pair of parentheses at the very end.
I never had this issue if I’m coding in a typical Windows Console Application in Visual C#.
IntelliSense is simply trying to help you type faster and avoid spelling mistakes. There is no need to type in things literally when using VS.
p TAB SPACE v TAB SPACE f TAB
That is all you need to make a private Fixed Update.method (no need to make it public is there?), and it even moves the text-cursor into the method ready to fill it in.
It works as intended and completes the method because there is only one thing in the list. You could disable IntelliSense but then you are one step closer to use a simple text editor I guess. Another option is to press CTRL+Z whenever IntelliSense made something you didn’t want.
Edit: like others have mentioned since this is part of a Unity plugin you should also be able to press the right mouse button and select “Quick Unity Messages” I belive the shortcut is CTRL+SHIFT+Q or M and search for the Monobehavior method you need.
Sometimes auto complete goes nuts. Check to make sure there are no errors in the script. Restart visual studio. See what happens.
Note that you shouldn’t get a suggestion for FixedUpdate. Which means you’ve got something weird going on. Do you have a Unity specific extension installed?
Not exactly. It’s only after I finish typing the full method name of the derived MonoBehaviour virtual methods, then pressing the left parenthesis, do the weird behavior starts happening.
I understand that by pressing the TAB key, it will autocomplete, as shown above when doing it the fourth time. However, the problem is focused on situations where you completely typed out the full method name, then hit the left parenthesis, the left bracket, the semi-colon, and other symbols that trigger IntelliSense.
That’s the part where I’m confused as to what’s going on.
I’m not supposed to have that? I don’t have any Unity specific extensions installed, other than the VSTU.
This is not an error. When you try to use standard mono methods, it tries to fill them in for you. Stuff like awake, start, update, ontriggerenter, etc. I noticed this in 2017.
I can type void Awake and then hit enter and it will add private, add () and add {} for me for example. It took a little getting use to, but since it’s only on the mono ones and not my own methods, it just didn’t bother me any.
There is probably a setting somewhere to turn it off if it bugs you.
Note also that 2017 of VS actually lets you install only what you need for Unity if you want. It does have autocomplete stuff for Unity built in. So it wouldn’t surprise me if you got these updates in 2015.
Bugs me too, because the auto-complete for the Unity Messages behaves differently than for all other methods. I can’t test it right now, but I remember turning it off, because I constantly ended up with additional parenthesis. I’ll do a test later and if it really works differently, I’d report it as a bug. In general it’s a cool feature.
Yes the auto complete is triggered when you type the parentheses, (), for the parameter list, which in my opinion is a mistake. It really should only auto complete if you press tab because for all it knows you could be typing a brand new method. For example if you create a new component type and want to add lets say 20 new methods to it, you have to deal with fixing this auto complete 20 times. So the best thing to do is disable it completely via Tools > Options > Tools For Unity > Unity Messages code completion = False. It still has syntax highlighting so you can see if your method name matches a Unity Message, but stops the editor from constantly code completing unnecessarily.