microsoft / microsoft/vscode-dotnettools

[SUGGESTION] Apply `UnityEngine.Serialization.FormerlySerializedAsAttribute` When Renaming

Open
#671 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-unity enhancement
Dominant language
No language data
Stars
321
Forks
54
Avg merge
2d 19h
Merged PRs (30d)
2

Description

Describe the feature you'd like

When having a field that has the attribute [SerializeField] and it gets renamed, it would be nice to automatically add the [FormerlySerializedAs] attribute so that references in the Unity editor, especially inside ScriptableObjects don't get destroyed.

// using UnityEngine;
// using UnityEngine.Serialization;

[SerializeField]
[FormerlySerializedAs("_oldName")]
Vector3 _newName;
Alternatives considered

Currently, the workaround is to apply the references anew or look changes up in git diff or add that attribute manually before switching back to the editor.

Environment Information

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files, tests, or implementation entry point; begin by locating the C# rename/refactoring path and its Unity integration. Done means renaming a [SerializeField] field preserves Unity references by adding the corresponding FormerlySerializedAs attribute, including for ScriptableObject references.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, unity
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.