GameObject <ParticleSystem> : Parent
GameObject <ParticelSystem> : Child
ParticleSystem ptc = GetComponentInChildren<ParticleSystem>();
Debug.Log(ptc.name); // "Parent"
solution:
*
foreach(ParticleSystem ptc in GetComponentsInChildren<ParticleSystem>()) { if( ptc.name == "Parent"){ //do something by parent } else if (ptc.name == "Child"){ //do something by Child } }
i think this method naming is wrong. many people get confused.
댓글 없음:
댓글 쓰기