- Home /
This question was
closed Sep 20, 2021 at 01:53 PM by
furkanmcaglar for the following reason:
Problem is not reproducible or outdated
Question by
furkanmcaglar · Sep 19, 2021 at 04:55 PM ·
c#instantiate
Instatiante as a child problem
Hello I have an object with 50 child. There are groups in it. When the number of children falls below a certain number, I want it to be created from the same object. Can you help?
private void Update()
{
if (Vector3.Distance(this.gameObject.transform.position,CloseGrounded.position)<1f)
{
BackBody();
}
}
void BackBody()
{
foreach (GameObject go in LosingBodyParts)
{
if (go.transform.childCount < 2)
{
for (int i = 0; i <10; i++)
{
GameObject a = Instantiate(prefabSphere, go.transform.position, Quaternion.identity);
a.transform.SetParent(LosingBodyParts[0].transform);
}
}
}
}
Comment
Answer: Yes! People can help.
But with what? What is the question? What exactly does not work? Why does it not work?
I am not stupid.What kind a wording is that? You MUST kindly warn.
Never$$anonymous$$d.I fix the problem.My problem was my code is never work. Have a nice day