Search Unity

From Parent object to childs

Discussion in 'Visual Scripting' started by qbsol123, Sep 18, 2021.

  1. qbsol123

    qbsol123

    Joined:
    Jul 15, 2020
    Posts:
    7
    Hello, im sending script flow from custom event to other object, then want specific flow to child object from this parent, could someone tell me simplest way how to get access to this child from parent?

    Bonus tip ;) this child object are a prefabs and i want just communicate with this childs under parent , even if they get same tags or names as prefabs.

    For any cases or courses about communication between parent and child i will be grateful
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,079
    Transform.childCount will return the count of child objects a parent has.

    You can use this int number to run a For loop using Transform.GetChild. Then do something with that child object.
     
    qbsol123 likes this.
  3. qbsol123

    qbsol123

    Joined:
    Jul 15, 2020
    Posts:
    7
    Thx for this smart combination!