Hello. I am trying to make a group of buttons appear in front of others. Modifying the “Pos Z” value in RectTransform doesn’t help. How can I do it?
UGUI items are rendered according to their order in the hierarchy.
You can change the order from script like this:
transform.SetAsLastSibling(); //move to the front (on parent)
transform.SetAsFirstSibling(); //move to the back (on parent)
transform.SetSiblingIndex( 2 ); //move to position, whereas 0 is the backmost, transform.parent.childCount -1 is the frontmost position
transform.GetSiblingIndex(); //get the position in the hierarchy (on parent)
As @trojen said UI elements under Canvas objects are rendered according to their hierarchy. Objects at the bottom will be rendered on top.
FOr example:

Txguug
3
You are supposed to use Unity - Scripting API: GUI.BringWindowToFront but I don’t understand how that works 
The ipointerhandlers make so much more sense to me.
So, @Priyanshu, per your answer, I figured out you can use SetAsLastSibling()
This is basically my script: assumes both elements have the same parent. Brings to front on click by making the clicked object last in the hierarchy
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using System;
public class gui_bringtofront: MonoBehaviour, IPointerDownHandler
{
public void OnPointerDown(PointerEventData eventData)
{
transform.SetAsLastSibling();
}
}