Quantcast
Channel: Latest Questions by alexkaskasoli
Viewing all articles
Browse latest Browse all 56

Unity unexplicably freezes on a very simple procedure

$
0
0
I'm working on the very beginnings of a random level generator. I'm running this code: using UnityEngine; using System.Collections; public class Generator : MonoBehaviour { public GameObject rock; // Use this for initialization void Start () { Desert (10, 10, 2, 2); } // Update is called once per frame void Update () { } void Desert(int startx, int startz, int width, int length) { Vector3 pos; for (int i = startx; i < width + startx; i++) { for (int j = startz; i < length + startz; j++) { pos = new Vector3(i, 0, j); Instantiate(rock, pos, Quaternion.identity); } } } } All this does is generate a 2 x 2 square using a prefab cube of (1, 1, 1) with a texture on it. Running this very simple code cause my Unity to freeze and pretty much die. My computer is not a beast but it's been through much, much worse. Can anyone explain why this would freeze?

Viewing all articles
Browse latest Browse all 56

Trending Articles



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