Quantcast
Channel: Questions in topic: "editing"
Viewing all articles
Browse latest Browse all 111

How to script the creation of a grid of cubes to be viewed in scene view

$
0
0
My game requires a ground that is a grid made up on a bunch of cube primitives touching each other like this http://postimg.org/image/i337flmr5/ (yes that's the cell games in DBZ) Except the way I currently implement the grid creation is that I have the following script attached to the camera: void Start () { float y = 0; for (int x=-10; x<10; x++) { for (int z = -10; z<10; z++) { cube = (GameObject)Instantiate (Resources.Load ("Prefabs/Cube"), new Vector3 (x, y, z), Quaternion.identity); } } } The problem with this implementation is that I am unable to edit my level in scene view because the grid does not get created until I run the level (which at that point I cannot edit the level since the game is running) I do not want to manually drag and drop 100 cubes to be positions next to each other in the level editor. Is it possible in Unity to somehow write a script to do this for me and display the cubes BEFORE I run the level, not during?

Viewing all articles
Browse latest Browse all 111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>