Author |
Topic |
|
StoshFerhobin
New Member
USA
5 Posts |
Posted - Feb 18 2020 : 5:36:40 PM
|
So in C# and Unity,
Typing "GetComp" brings up some auto complete choices, going down to "GetComponent<>" and hitting enter now results in : GetComponent()
Which is wrong, I need <> not ()
I tried adding a snippet of my own but this is the only thing that shows up.
How to fix please? I type this command constantly in Unity. |
|
feline
Whole Tomato Software
United Kingdom
19061 Posts |
Posted - Feb 19 2020 : 06:22:26 AM
|
VA does not currently automatically insert the <> brackets for a template or generic function, but this is a change we are considering making:
case=460
but a VA Snippet should work just fine here. How have you set up your snippet?
As a simple test case, I have created a C# snippet with the shortcut "GC" and set it to insert the code:
GetComponent<$end$>()
so the caret ends up between the angle brackets, and this works as expected for me, using VS2017 and VA 2358. This does require having turned On
VA Options -> Suggestions -> Suggestion and Completion lists Enable in C#
|
zen is the art of being at one with the two'ness |
|
|
StoshFerhobin
New Member
USA
5 Posts |
Posted - Feb 19 2020 : 4:54:16 PM
|
Okay thanks, changing the shortcut to something else such as "GC<" works instead of pulling up the long list of default GetComponent menu options.
It would be really nice if VA could do this, as default c# somehow does |
|
|
feline
Whole Tomato Software
United Kingdom
19061 Posts |
Posted - Feb 20 2020 : 05:38:30 AM
|
We are aware of this limitation with VA. In some situations functions / classes are overloaded, so one version requires <> and another version does not require this, so it's not always obvious how best to handle this.
Hopefully for now the snippet is working well for you and helping you to work around this. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|