I want to create a 2D terrain generator for my own game. I know the general idea. How should I store Vectors(vertices) of mesh? When I was doing this in another platform, I used to create a serializable file for them and read at the beginning of level. Then I was activating physics bodies and meshes part by part in respect of my car’s position, for performance issues. For now all I can do is to enter vertices in script by hand I don’t know how to predefine, and display in scene before runtime.
You could just create a new Mesh instance and save it as an asset using AssetDatabase.CreateAsset. If you don’t want to be working directly with Meshes, you can consider using ScriptableObject (together with AssetDatabase.CreateAsset)
If your wanting 2D Voxel Generation, look at these tutorials: