I created a 2d array of gizmos like this
void OnDrawGizmos()
{
for (int i = 4; i <= 8; i += 2)
{
for (int j = 12; j >= -12; j -= 2)
{
Gizmos.DrawWireSphere(new Vector3(j, i, -5f), 1);
}
}
}
then I want to instantiate a prefab in each single gizmo , I did it like this
foreach (Transform child in transform)
{
GameObject tie_fighter = Instantiate(Resources.Load("tie-fighter"), child.transform.position, Quaternion.identity) as GameObject;
tie_fighter.transform.parent = child;
}
The problem is that the prefabs are instantiated at only one position, there are no separate gizmos it is only one gizmo, all the drawn gizmos don’t have actual transform position. How can I solve this ??
-
EnemiesCreation: GameObject contains the Prefabs creation script.
-
EnemiesPositions: GameObject contains the Draw Gizmos script.