Why is Unity ignoring the initialized value of a non-static public field?
<p>I'm using <a href="http://docs.unity3d.com/ScriptReference/MonoBehaviour.InvokeRepeating.html" rel="noreferrer"><code>InvokeRepeating()</code></a> to call a method in a game. I call <code>InvokeRepeating()</code> in the <code>Start()</code> method of one of the <code>GameObject</code>  classes. To set the <code>repeatRate</code> parameter for <code>InvokeRepeating()</code>, I am passing it a public field called <code>secondsBetweenBombDrops</code>.</p>

<p>Unity ignores the value I specify for <code>secondsBetweenBombDrops</code> in the code and instead uses some default value (i.e. 1) when <code>secondsBetweenBombDrops</code> is declared without a static modifier:</p>

<pre><code>public float secondsBetweenBombDrops = 10f;
void Start() {
    InvokeRepeating("DropBomb", 1f, secondsBetweenBombDrops);
}
</code></pre>

<p>However, once I add the <code>static</code> modifier to <code>secondsBetweenBombDrops</code>, the code behaves as expected and the correct value of 10 is used:</p>

<pre><code>public static float secondsBetweenBombDrops = 10f;
void Start() {
    InvokeRepeating("DropBomb", 1f, secondsBetweenBombDrops);
}
</code></pre>

<p>Why does this field require the <code>static</code> modifier to use the appropriate value?</p>

<p>In the Unity inspector, the script component shows that <code>secondsBetweenBombDrops</code> is 1. This default value of 1 is present regardless of whether I instantiate the prefab on game start or create prefab instances while the game is running.</p>