"extract" option not showing up when refactoring

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.
Screenshot 2022-10-03 164203

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.

Regards,
Kerry

image
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.

Regards,
Kerry

VS Code

Hi Moonexe404,

Welcome to our community! :slight_smile:

Please follow the instruction on this website and make sure all required extensions are installed: https://code.visualstudio.com/docs/other/unity

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

Did this help?


See also:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms