Created
May 7, 2015 03:53
-
-
Save Q-Bert-Reynolds/e03b9e8b2fbc186ef189 to your computer and use it in GitHub Desktop.
getting the unity terrain brush size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// to get the terrain brush size in an editor script | |
EditorPrefs.GetInt("TerrainBrushSize") | |
// if you need to get the terrain brush size from a non-editor script (monobehaviour) | |
System.Type editorPrefs = System.Type.GetType("UnityEditor.EditorPrefs, UnityEditor", false, false); | |
System.Type[] paramTypes = new System.Type[]{ typeof(string) }; | |
System.Reflection.MethodInfo method = editorPrefs.GetMethod( | |
"GetInt", | |
BindingFlags.Public | BindingFlags.Static, | |
null, | |
paramTypes, | |
null | |
); | |
int terrainBrushSize = (int)method.Invoke(null, new string[]{"TerrainBrushSize"}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment