Creating GameObjects via script NOT at runtime

Hi,

i want to create a grid on top of my terrain and therefore create and modify my grid-gameobjects via script in my scene. I would know how to do that at runtime, but i want to do this only once and keep the changes after the game ends.
Im pretty sure it is possible to execute scripts outside of the game, but i have no idea where to start and look for the functionality. Can someone push me in the right direction?

Best Regards

add [ExecuteInEditMode] to the top of your script for c# or for javascript add @script ExecuteInEditMode()

above monobehaviour , i usually have simple bool that then creates an object like so .

[ExecuteInEditMode]
public class myclass : MonoBehaviour {
public bool createGameObject;

void Update(){
if(createGameObject){
//instantiate what you want here
}
}