public void createTopBar() { if (topBar_Script == null) { topBar_Holder = new GameObject("TopBar_Holder"); int number = 8; for (int i = 0; i < number; i++) { topBar_Script = new Create_Bars_fire_Script(); topBar_Script.AddBar(camera.ScreenToWorldPoint(new Vector3(i * Screen.width / 4, camera.pixelHeight, 10)), i, topBar_Holder, "NEIN"); } float pixelRatio = (camera.orthographicSize * 2) / camera.pixelHeight; SpriteRenderer a = GameObject.Find("TopBar_0").GetComponent<SpriteRenderer>(); scrollArea = new Rect(0, 0, Screen.width, a.sprite.bounds.size.y / pixelRatio); absoluteMinX = topBar_Holder.transform.position.x - (a.sprite.bounds.size.x * 4 * a.gameObject.transform.localScale.x); absoluteMaxX = topBar_Holder.transform.position.x; } }
public void deleteTopBar() { Destroy(topBar_Holder); scrollArea = new Rect(); topBar_Script = null; }