예제 #1
0
        /// <summary>
        /// Execution callback after detach and reattach.
        /// </summary>
        /// <param name="trans"> Transform you want to detach and reattach after callback. </param>
        /// <param name="callback"> Callback after detach and before reattach. </param>
        public static void ReattachSelf(Transform trans, ReattachCallback callback)
        {
            if (trans == null || callback == null)
                return;

            var parent = trans.parent;
            trans.SetParent(null);

            if (callback != null)
                callback.Invoke(parent);

            trans.SetParent(parent);
        }
예제 #2
0
        public static void ReattachSelf(RectTransform trans, ReattachCallback callback)
        {
            if (trans == null || callback == null)
                return;

            var canvas = JCS_Canvas.GuessCanvas();

            var parent = trans.parent;
            trans.SetParent(canvas.AppRect);

            if (callback != null)
                callback.Invoke(parent);

            trans.SetParent(parent);
        }