using UnityEngine;
using System;
namespace DuloGames.UI
{
public static class UIUtility {
///
/// Brings the game object to the front.
///
/// Game Object.
public static void BringToFront(GameObject go)
{
BringToFront(go, true);
}
///
/// Brings the game object to the front while specifing if re-parenting is allowed.
///
/// The Game Object.
/// Should we allow the method to change the Game Object's parent.
public static void BringToFront(GameObject go, bool allowReparent)
{
Transform root = null;
// Check if this game object is part of a UI Scene
UIScene scene = UIUtility.FindInParents(go);
// If the object has a parent ui scene
if (scene != null && scene.content != null)
{
root = scene.content;
}
else
{
// Use canvas as root
Canvas canvas = UIUtility.FindInParents