Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 GetComponent
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

StoshFerhobin
New Member

USA
5 Posts

Posted - Feb 18 2020 :  5:36:40 PM  Show Profile  Reply with Quote
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
17771 Posts

Posted - Feb 19 2020 :  06:22:26 AM  Show Profile  Reply with Quote
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
Go to Top of Page

StoshFerhobin
New Member

USA
5 Posts

Posted - Feb 19 2020 :  4:54:16 PM  Show Profile  Reply with Quote
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
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17771 Posts

Posted - Feb 20 2020 :  05:38:30 AM  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2021 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000