public void BuildGroundBuildingSlots() { Debug.Log("Building building slots."); float stepAngle = 2 * Mathf.PI / nbStartBuildingSlots; float radius = mainPlanet.transform.localScale.x / 2; //Debug.Log("StepAngle: " + stepAngle + " | Rayon: " + radius); for (int i = 0; i < nbStartBuildingSlots; i++) { float angle = stepAngle * i; Vector3 pos = new Vector3(Mathf.Cos(angle) * radius, Mathf.Sin(angle) * radius, mainPlanet.transform.position.z); GameObject instantiatedSlot = Instantiate(buildingSlotPrefab, pos, Quaternion.identity); instantiatedSlot.transform.SetParent(buildingSlotsParent.transform); groundBuildingSlots.Add(instantiatedSlot); allBuildingSlots.Add(instantiatedSlot); BuildingSlot bs = instantiatedSlot.GetComponent <BuildingSlot>(); bs.id = (100 + i); bs.locationType = BuildingManager.BuildingType.BuildingLocationType.Planet; bs.SetDefaultColor(); bs.angleRad = stepAngle * i; } ResetAllBuildingSlotsColor(); }