- Home /
Prefabs spawn with wrong values
I have a prefab with a custom script on it. The script has a float variable that's given a default value (lets say it's 10) when it's declared. In the Inspector, it says the value of the variable on the prefab is the same as the value in the code (still 10). So far so good.
To test a new value (lets pretend it's 20), I changed the variable's value in its declaration. The Inspector value in the prefab updated to reflect the new default. Perfect. This is all happening in the editor: I haven't run the game yet.
When I instantiate the prefab at runtime however, the instance has the first value (10), not the new one (20). The original prefab in the Project window still holds the new value (20) and the code says it's declared with the new value (20) so where is the old value being stored and how do I force it to use the new one?
Is there a cache I can delete?