How to change editor grid size by script?

Hi,
Is there a way to change the grid size in the editor by using script? I mean the “Grid Visuals” in Grid and Snap window.


the game designer in my team want some utilities to help him speed up level designing, he want to change these settings by some preset value (with a button click) and manual input.

I can change the snap settings with EditorSnapSettings but I cannot find any API to change the grid size.

I’m using Unity 2019.4.9f1

Thank you for reading,
Tom.

Anyone?

GridSettings is currently internal, apparently.
https://github.com/Unity-Technologies/UnityCsReference/blob/61f92bd79ae862c4465d35270f9d1d57befd1761/Editor/Mono/SceneView/SceneViewGrid.cs

Solution: Use Reflection to get the Grid Size property

Assembly assembly = Assembly.Load("UnityEditor.dll");
Type gridSettings = assembly.GetType("UnityEditor.GridSettings");
PropertyInfo gridSize = gridSettings.GetProperty("size");
gridSize.SetValue("size", new Vector3(1,2,3));

It works like a charm! Thanks.

For anyone who’s looking for a conventional method, there’s public API:
EditorSnapSettings.gridSize