- Home /
Gradient Changes in Editor Reset In Play Mode. Why?
Hi I don't understand why the following is happening:
There is a bunch of Gradients stored in a public array that I can set and modify in the inspector in editor mode. But when I go into play mode, all the Gradients in the array reset to default. There is nothing affecting the Gradient array in Awake, Start or anywhere else.
public Gradient[] boundaryColors;
I can store each Gradient as a public field, configure it in the Inspector and and press play and they carry over into play mode just fine. EDIT: actually, it seems I can't seem to add any new gradients at all that carry over into playmode, whether they're in an array or by themselves. But the existing gradients work.
public Gradient blueBG, lizardBG, purpleBG, bloodyBG;
I have other arrays of an object type that basicaly just contains two Colors which carry over from Editor mode to Play mode just fine, so it seems to me to be related to Gradients, though I don't know why they would handle differently.
[System.Serializable]
public class BGColorSet {
public Color cell;
public Color line;
}
public class GridController : GridBehaviour<FlatHexPoint> {
public BGColorSet[] myColorSets;
//other unrelated stuff
}
What am I missing? I am using Advanced Inspector.
Thanks for any pointers!
Answer by arbazgillani · Sep 28, 2018 at 10:09 AM
Make it serializable it will not get reset then.
Thanks for your answer. However, that's not the issue here, it seems. I can only make classes serializable, public fields should be serialized iirc (and it works elsewhere). I've given the [SerializeField] attribute a try, which is normally for private fields, but it doesn't solve the issue.
The issue appears to be related to the Advanced Inspector plugin clashing with another custom inspector, it seems.