So, this is my code, and whenever I click play, the editor freezes. However, if I comment out the line "Debug.log (pos );", then it wouldn’t.
using UnityEngine;
using System.Collections;
public class SpawnChair : MonoBehaviour
{
-
public float radius;*
-
public int numForSpawn;*
-
public GameObject prefab;*
-
GameObject theObject;*
-
Vector2 pos = new Vector2[5];*
-
float x, y;*
-
void Awake ()*
-
{*
-
for (int i = 0; i < numForSpawn; i++)*
-
{*
-
do*
-
{*
-
x = Random.Range (0, radius + 0.01f);*
-
y = Random.Range (0, radius + 0.01f);*
_ pos = new Vector2 (x, y);_
* Debug.Log (pos [0]);*
_ } while (Mathf.Sqrt (x * x + y * y) != radius);_
* theObject = Instantiate (prefab) as GameObject;*
_ theObject.transform.position = pos ;
* }
}
}*_