Search code examples
unityscriptunity-game-engine

Move Gameobject to bottom of heirarchy using UnityScript


So i was wondering how to move an object to the bottom of the hierarchy inside of its parent. I am going to use it to put an image over another image. Please answer in UNITYSCRIPT


Solution

  • Use these methods in Transform:

    transform.SetAsFirstSibling ();
    transform.SetAsLastSibling ();
    transform.SetSiblingIndex (5);
    

    The names of the methods tell everything you need, I think.