IEnumerator CreateNeedle() { while (true) { yield return(new WaitForSeconds(UnityEngine.Random.Range(minLevel.Key - level, minLevel.Value - level) * Time.deltaTime)); GameObject activeNeedle = poolingmanager.getNeedle(0); activeNeedle.transform.position = new Vector2(-camWidth / 2, -camHeight / 2 + needle.GetComponent <Renderer>().bounds.size.y / 2); needleSetting = activeNeedle.GetComponent <Needle>(); needleSetting.setVarialbe(1, 0); needleSetting.randomizeState(3f, 6f); activeNeedle.SetActive(true); } }