Rename
Rename a method or editable member from the identity header, then Compile the source change.
On this page
A method called HandleThing may make sense on day one and become vague once coins, enemies, and doors share the class. Give it the gameplay name it earned.
The problem
Section titled “The problem”A rename changes source identity, so it must be validated against C# naming rules and sibling signatures. It also needs to stay reversible while you are still choosing the name.
When to reach for it
Section titled “When to reach for it”Use in-place rename for an ordinary method or an editable declaration owned by the selected class. The right-rail identity header is the source of the action because it already shows the exact thing being renamed.
A method you make with the Methods + is named once, on its own rail row, when it is made. The row opens as a name box holding the default name (NewMethod, then NewMethod1, NewMethod2), all of it selected. Enter names the method, Escape keeps the default, and an empty name, a keyword, the class’s own name, or a name the class already has shows its reason as you type. Every later rename goes through the identity header described below.
Lifecycle method names are read-only. Their names are the contracts Unity invokes, so changing one would stop the callback from running.
See it
Section titled “See it”
- Select the method or editable member so its identity appears at the top of the right rail.
- Focus the identity header and press F2. Hover or keyboard focus also reveals
Rename · F2. - Type the new C# identifier. The editor checks it while you type.
- Press Enter to commit the name into the draft. Clicking away also commits.
- Press Escape if you want to cancel the active text edit and restore the prior draft name.
- Read any field-local callout. An invalid identifier or a collision stays in the editor until it is repaired or cancelled.
- Inspect the graph and the Previewing your changes. state. The
.csfile still carries the old name. - Press Compile. Round Trip writes the signature edit, imports the file, and reopens the renamed method from parsed source.
What it writes
Section titled “What it writes”Only the source-owned identity edit is written. Canvas placement, viewport, and reroute knots are unaffected by the method name change.
When it goes wrong
Section titled “When it goes wrong”When it goes wrong
| Symptom | Check | Fix |
|---|---|---|
| The name field shows a callout | Look for an invalid character, reserved keyword, or colliding signature. | Repair the identifier in place or press Escape. |
| F2 shows a lock reason | Confirm this is a lifecycle method or inherited member. | Keep the contract name or rename the declaration in the file that owns it. |
| Source still has the old name | Look for the Previewing your changes. banner. | Press Compile when the draft is ready. |