Hi guys im a newbie of unity and also english so i have small issue about rotatearound
the problem is think like this i wanna try instantiate 2 square and 1 sphere so sphere should be rotatearound in z rotation okay there is no problem but when i instantiate the second 2 square and 1 sphere then the first instantiated sphere going to reference second i only want to every instantiated sphere should be rotate its own reference i tried different kind of code but i couldnt achieve so if u can help me thanks
int r1 = Random.Range(0, 7);
// int r2 = Random.Range(0, 7);
//int r3 = Random.Range(0, 7);
GameObject gm1 = Instantiate(_randomsq[r1], new Vector3(-2.46f, p, 0f), Quaternion.identity);
gm1.transform.localScale = new Vector3(1.5f, 1.5f);
GameObject gm2 = Instantiate(_randomsq[r1], new Vector3(2.46f, p, 0f), Quaternion.identity);
gm2.transform.localScale = new Vector3(1.5f, 1.5f);
GameObject gm3 = Instantiate(_randomsp[r1], new Vector3(-2.46f, p, 0f), Quaternion.identity);
gm3.transform.localScale = new Vector3(0.8f, 0.8f);
rotara = gm1.gameObject.transform.position.y;
gm3.AddComponent<rotatearaound>();
gm1.transform.parent = GameObject.Find("SpawnManager").transform;
gm2.transform.parent = GameObject.Find("SpawnManager").transform;
gm3.transform.parent = GameObject.Find("SpawnManager").transform;
p += 2.45f;
rotatearound code
ransform.RotateAround(new Vector3(0, _level.p, 0), new Vector3(0, 0, 1), 90f * Time.deltaTime);
// transform.RotateAround(Vector3.zero, Vector3.forward, 90 * Time.deltaTime);
//transform.RotateAround(new Vector3(0, _level.rotara, 0), new Vector3(0, 0, 1), 90f * Time.deltaTime);