Search code examples
unity-game-enginenextsibling

Get Next Sibling gameobject(transform) Method in unity3d C#


looking a method or a Library for something like this:

GameObject nextBrotherNode= gameObject.transform.getNextSibling();

Solution

  • You mean

    int index = transform.GetSiblingIndex();
    GameObject nextBrotherNode = transform.parent.GetChild(index + 1).gameObject;