Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Methods in Scene Files #32

Closed
tinjaw opened this issue Mar 25, 2016 · 9 comments
Closed

Rename Methods in Scene Files #32

tinjaw opened this issue Mar 25, 2016 · 9 comments
Labels
Milestone

Comments

@tinjaw
Copy link

tinjaw commented Mar 25, 2016

When you have things like events tied to button clicks, they are embedded in the .unity (scene) file as strings. (see m_MethodName: in a text (not binary) scene file).

When Resharper suggests changing the method name in the .cs file, it should take into account any matches in scene files. If the method name is changed, R# should also change it in the scene file to keep them linked.

@citizenmatt
Copy link
Member

I don't know Unity well enough here. Do you have a sample that can show the .unity file in use?

@tinjaw
Copy link
Author

tinjaw commented Apr 14, 2016

I think all you need to worry about is

m_MethodName: OnClick

Where OnClick is the string that gets changed if the method is renamed by
ReSharper.

Attached are two files. One with no action attached to the button click and
one with the action added, so you can see everything associated with adding
an action method.

Please let me know if you need more information.

PS. A .unity file is a Scene File. You would need to grep every .unity file
and look for the method.

On Thu, Apr 14, 2016 at 7:18 AM, Matt Ellis [email protected]
wrote:

I don't know Unity well enough here. Do you have a sample that can show
the .unity file in use?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#32 (comment)

@TarasOsiris
Copy link

Not always a good idea as half of the times scenes are serialized to binary and you won't be able to modify it. Also you will have to do yaml parsing and I am not sure its a good idea for ReSharper to touch non-C# files (if something goes wrong it can mess up the scene).

@citizenmatt citizenmatt added this to the Someday milestone May 23, 2016
@citizenmatt
Copy link
Member

This could be an interesting extension. It would require teaching ReSharper a new file format, which is a non-trivial task (but could be fun 😄), and it does look as though it would require Unity to only save in text format, rather than the default binary. It also looks like the .unity files aren't added to the .csproj files by default, and ReSharper doesn't really know about files that aren't part of the project.

I'm trying to clean up the issues list, so I've moved this to a "Someday" milestone, as something to think about for a later time.

@cmcpasserby
Copy link
Contributor

due to the possibility of hosing a whole scene doing this, the best use of it i could see, would be having resharper let you know what scenes and prefabs your Component is referenced in.

@breineng
Copy link

breineng commented Sep 4, 2018

it really would be useful

@andgeno
Copy link

andgeno commented Jan 4, 2019

Would also like to have this feature. It's really tedious to re-map those broken links every single time after refactoring a method's name.

@StephenHodgson
Copy link

StephenHodgson commented Jan 5, 2019

Fryi, Serialization doesn't just happen for scene assets, but any serialized asset like a prefab, scriptable object, or even inspector files where the serialized object needs to get a reference

@citizenmatt
Copy link
Member

Fixed in #1140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants