While trying to extract a line of code into a method the option for extract will not show up. highlighting the line of code and pressing ctrl+ ‘.’ or ctrl+shift+R only shows up with “surround with…” instead of anything else.
any and all help will be appreciated and if additional info is needed I will be happy to provide.
Hi, Which editor are you using ?
Looks to me you chose the option to “Surround” the code not “Extract Method”
Try Selecting the code you want to extract and then Right Click mouse.
Each option works for me in both VIsual Studio and Rider.
Just a note, I can’t see a benefit in Extracting just that one line of code ; but I s’pose it depends what you are attempting and why.
when taking a line of code like so it gives me the option for refactoring. when clicking on refactoring it shows up with the surround option instead of anything else. as far as the editor I’m using I’m a little confused about that so that might be the issue.
on a side note i did figure out how to do it manually and make a method to just copy and paste it but later down the road i know it will be more useful
. . . as far as the editor I’m using I’m a little confused about that . . .
I meant :
Which code editor ( IDE ) are you using
ie Visual Studio, VS Code, Rider, other ?
They have a slightly different interface , and functionality may vary depending on your configuration.
If the issue persists, please check the console of VS Code (not Unity!). If the .NET Framework 4.7.1 (Developer Pack) is mentioned there, download and install it from the official Microsoft website. Here is the link: https://dotnet.microsoft.com/download/dotnet-framework/net471