Using scripts to populate a map

Is there a way to write a script that populates a world with some assets and then saves those assets into the scene instead of placing them manually?

My problem is that I plan to do pathfinding in my game through a grid of waypoints, the game I’m designing “aims” to be more or less like Dungeon Siege. I certainly do not want to place hundreds, or even thousands of waypoints in my world by hand. I also do not want to dynamically create such a grid when the game starts up, I want to be able to generate the grid through a script, touch it up by hand if need be, and save it all into the scene. This is of course do-able by writing an external program and generating a data file that describes the waypoints, but that’s a bit of a hassle, is there a way to do this from within Unity?

This problem is certinaly not limited to calculating a grid of nodes. I can see such scripts being very useful when populating the world with things like vegetation, which is not always feasible in an external 3d app, especially if you need each item to be a seperate GameObject.

If this is not possible then might as well move this post to the “Wish List” :slight_smile:

Alternatively if someone knows a clever way of doing pathfinding without precalculated nodes and an "A* like " algorithm then please do share!

Editor scripts are perfect for this.

http://unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Editor_Classes.html

If you poke around in those classes there are some examples to get you started. Like in here: http://unity3d.com/Documentation/ScriptReference/MenuItem.html

Some samples, but not doing much of what you want:
http://www.unifycommunity.com/wiki/index.php?title=Script_Archive#Editor_Scripts

Cheers,
-Jon

Ah yes, that’s exactly what I wanted. This is a really great feature!