mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Syntax
This commit is contained in:
parent
370f66b9b4
commit
e9717d87ad
@ -232,14 +232,14 @@ public static void BalancePrefabs(GameObject prefab, int amount, Transform paren
|
|||||||
// instantiate until amount
|
// instantiate until amount
|
||||||
for (int i = parent.childCount; i < amount; ++i)
|
for (int i = parent.childCount; i < amount; ++i)
|
||||||
{
|
{
|
||||||
GameObject go = GameObject.Instantiate(prefab);
|
GameObject go = Instantiate(prefab);
|
||||||
go.transform.SetParent(parent, false);
|
go.transform.SetParent(parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete everything that's too much
|
// delete everything that's too much
|
||||||
// (backwards loop because Destroy changes childCount)
|
// (backwards loop because Destroy changes childCount)
|
||||||
for (int i = parent.childCount-1; i >= amount; --i)
|
for (int i = parent.childCount-1; i >= amount; --i)
|
||||||
GameObject.Destroy(parent.GetChild(i).gameObject);
|
Destroy(parent.GetChild(i).gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnUI()
|
void OnUI()
|
||||||
|
Loading…
Reference in New Issue
Block a user