Override default values for a game object

Viewed 29

Problem

I have same problem like here: whenever I change default field value in the script

public class SomeScript : MonoBehaviour
{
    public float someParameter = 30; // was 10
                                     // changing value here will not update objects in scene, prefabs, etc.
                                     // all of them will still have value 10
...
}

it will not update itself in prefabs, since Unity serialize values on its own, which is often a good thing.

Workarounds like going through all prefabs and clicking "Reset" or applying [NonSerialized] attribute shortly (or changing name) and then removing it after saving are really a hassle.

Then I noticed the "Visual Effect Graph" editor already solve this problem: there is a checkbox near to each property, keeping checkbox unchecked will ensure the latest values in all prefabs will be taken from effect whenever I change the default value there. And it is still possible to override default value if necessary.

Visual Effect Graph

Question

How can I add this "override default value" checkbox to basically all fields/properties of my scripts?

Perhaps there is an alternative: a way to make certain properties being editable (in game mode?) in the editor but not being serializable by Unity somehow?

It would be nice to have a solution without much of hassle or effort, like writing custom Editor for each script (would be a terrible solution).

0 Answers
Related