I’m not sure if it’s a bug or some kind of a setting which i don’t know of, but I’m unable to change values in inspector inside a List of a nested class in ScriptableObject after I run a game. If i force to recompile my scripts or add and delete element of this list - it solves this problem until i run a game again which is not very destructive, but quite annoying to do this all the time if i just need to see how my game works with different values.
public class MiniGameLevels : ScriptableObject
{
public virtual float complexityFactor { get; set; }
}
public class MGRBT_Levels : MiniGameLevels
{
[SerializeField] List<GameModes> gameModes;
[HideInInspector] public GameModes GameMode;
public void UpdateComplexity()
{
if (complexityFactor < 1) GameMode = gameModes[0];
}
[Serializable]
public class GameModes
{
public string Name;
public bool IsSequenceZoneActive;
public MGRBT_GridParameters GridParameters;
public bool UseActiveGridZone;
public Vector2Int ActiveGridZone_Min;
public Vector2Int ActiveGridZone_Max;
public List<ButtonAvailability> ButtonsAvailable;
}
[Serializable]
public struct ButtonAvailability
{
public MGRBT_Button Button;
// 0 - for infinite
public int Amount;
}
}
There are countless of things unclear. First of all you showed us 3 types, two are marked as serializable (GameModes, ButtonAvailability) one is not (MGRBT_Levels). That may be a scriptable object but we don’t know that since we don’t know what “MiniGameLevels” is. We also don’t know what “MGRBT_Button” and “MGRBT_GridParameters” are.
We still don’t know what “values” you actually changed that did not persist. We also don’t know if any of your types have custom property drawers or custom inspectors which may be implemented wrongly.
Apart from that note that you serialized the “gameModes” as well as “GameMode” field. Keep in mind they are serialized separately. That means when you assign the first element of your gameModes array / list to the GameMode field, both will contain the same instance reference. However after serialization / deserialization the GameMode field will have it’s own duplicate instance that has no connection to the element stored in the List.
So it’s really difficult to actually understand your problem here or what exactly went wrong.
Sorry, for not describe it properly, i updated my code there… but my problem is that in inspector, after running my game i can’t press or change any field values here:
But basically speaking this script contains starting conditions of my minigame and depending on complexity it chooses which gamemode to use (for now it’s only one). I can insert other script codes also, if you think it’s needed, but i think it will lead away from my problem. Don’t know