Inspector public inputs and their limited use

Say I have a script I use for many objects, and a public float. As I am aware, I can alter the float or integer, as it happens to be, in the Inspector window for each Object. This overrides any setting declared in the script, so you can vary each object.

But, when you have the issue where you have to keep resetting the float or integer, if it does not remain constant, because it is a timer for example, in the script, the code to reset the timer again is the same for all objects, unless of course, you say if Object A, reset to this, if Object B reset to that. So then those inspector values, per object, are only implemented at the beginning.

Is there any code to use in the script to reset the values back to what you have inputted in the inspector window, to save this effort of singling them out?
Otherwise it appears, the Inspector input to change variables per object, when using the same script, is only for values that remain constant.

This is to investigate if I can use these inspector declarations, to make my development easier, if there was a way to say in the script, reset to those default values you had for each object in the inspector window.

any ideas?

The values change back to what they were set in the inspector when Play Mode is ended or the scene is reset and they’re reinstantiated. If you’re talking about resetting them while in Play Mode, then no, but I can’t imagine why you’d need to. If you don’t want the value to change, then don’t change it.

In your countdown scenario, just use the value set there as the initial time and do your counting in another (private) field instead. If you’re using coroutines, there’s not even any reason to keep track of the time explicitly, since the yieldinstruction will take care of that for you.

On a related note, you really shouldn’t be making these fields public at all- public fields are dangerous- your script has no way of telling if they’re being changed from the outside. Instead, you may want to try putting the SerializeField attribute on them and leaving them private or protected. Then, since you’ll be setting up properties for allowing other scripts to access that data, you can trivially make a second private field that’s actually used for storing the “current value”, while the original inspector-exposed field is only used to keep the initial value. Just copy the “initial value” to the “current value” in Awake.