[ShowInInspector]don't store data
Issue #888
resolved
I use code below to store and to adjust something’s positiong in grid.
[ShowInInspector] public Vector2Int pos {
get => _pos;
set => _pos = value;
}
private _pos;
Then I change the value of it on the inspector to (1, 0), but when I hit the play button, the value change back into (0, 0). I found it that the value even wasn’t (1, 0) when unity execute Awake() in debugging mode.
Comments (5)
-
-
reporter You are absolutely right. Thanks a lot!
-
reporter - changed status to resolved
-
reporter - changed status to open
-
reporter - changed status to resolved
- Log in to comment
This is the desired behavior.
ShowInInspector
is usually used for debug purpose to be able to see certain values while in play mode. It does not serialize anything.What you probably want to do instead is this: